Hi, i made a part in my game with two scripts. One script makes a clickdetector appear in the part and the other one makes the part visible. Both things happen after 15 seconds of joining the game. In studio place it works completely fine there are no problems, however, when i test this in a real roblox server it doesn't work. Whats the problem? Both scripts are normal scripts. (By the way when i join in a real roblox server, the scripts will run but they won't wait 15 seconds.)
Script1: Makes the part visible.
wait (15) script.Parent.Transparency = 0
Script2: Inserts a clickdetector in the part.
wait (15) ClickDetector = Instance.new("ClickDetector", workspace.HouseButton) ClickDetector.Name = "ClickDetector1" ClickDetector.MaxActivationDistance = 500
--Thanks :D
There is a space between wait and the number.
wait(15) --Correct
not
wait (15) -- Incorrect
;)
It is also useful to do the following;
Script 1:
game.Players.PlayerAdded:connect(function(plr) game.Workspace:WaitForChild(plr.Name) --Waits until the player's character has loaded. wait(15) script.Parent.Transparency = 0 end)
Script 2:
game.Players.PlayerAdded:connect(function(plr) game.Workspace:WaitForChild(plr.Name) --Waits until the player's character has loaded. wait(15) ClickDetector = Instance.new("ClickDetector", workspace.HouseButton) ClickDetector.Name = "ClickDetector1" ClickDetector.MaxActivationDistance = 500 end)