I’m very new to scripting and am not sure why this script isn’t working. I made it where when you say a certain phrase in chat something will happen. The thing is whenever I say the certain phrase in chat nothing happens and I am getting no errors.
Ok so too start I have a local script in StarterPlayerScripts:
local Block = game.ReplicatedStorage.Block:Clone()
local Rain = game.ReplicatedStorage.Rain:Clone()
local Cloud = game.ReplicatedStorage.Cloud:Clone()
Block.Parent = game.workspace.CurrentCamera
Rain.Parent = game.workspace.CurrentCamera
Cloud.Parent = game.workspace.CurrentCamera
game.Players.PlayerAdded:Connect(function(player)
player.Chatted:Connect(function(message)
if message == "/e hello" then
Block:Destroy()
Rain:Destroy()
Cloud.CloudPiece1.BrickColor = BrickColor.new("Pearl")
Cloud.CloudPiece2.BrickColor = BrickColor.new("Pearl")
Cloud.CloudPiece3.BrickColor = BrickColor.new("Pearl")
end
end)
end)
I think that’s all I have though, I just don’t know what I did wrong here. I think I might have to move it too ServerScriptService but I’m not too sure. Thanks
You need to put everything you have in the local script into the server script, and completely remove the local script, this error is happening because you never added the variables into the server script