Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function onPlayerChatted(player, message)
- if message == 'Cube' and player.Character and player.Character:FindFirstChild("Head") then
- print "Chatted Cube"
- player.Character.Head.Transparency = 1
- player.Character.Head.face.Transparency = 1
- for _, instance in pairs(player.Character:GetDescendants()) do
- if instance:IsA("MeshPart") then
- instance.Transparency = 1
- end
- end
- for _, instance in pairs(player.Character.Head:GetDescendants()) do
- if instance:IsA("Part") or instance:IsA("MeshPart") then
- instance:Destroy()
- end
- end
- local part = Instance.new("Part")
- part.Parent = workspace
- part.CanCollide = false
- local weld = Instance.new("Weld")
- weld.Parent = part
- weld.Part1 = player.Character.Head
- weld.Part0 = part
- part.Size = Vector3.new(5,5,5) -- The cube size
- part.Anchored = false
- part.CFrame = player.Character.Head.CFrame
- end
- end
- local function onPlayerAdded(player)
- player.Chatted:Connect(function (message) onPlayerChatted(player, message) end)
- end
- game.Players.PlayerAdded:Connect(onPlayerAdded)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement