Help on plr chat

so i tried making a script and

game.Players.PlayerAdded:Connect(function(player)

player.Chatted:Connect(function(message)
if message == “setvalue random” then
game.ReplicatedStorage.avalue.Value = math.random(1,100)
if game.ReplicatedStorage.avalue.Value == 30 then
game.Workspace.Brick.smile.Texture = “rbxassetid://9642367027”

end
end
end)
end)

it doesn’t work for some reason the value went to 30 it only happens rarely

This code will function exactly as intended. Getting exactly 30 will take some time – consider lowering your random interval

2 Likes