Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

My scripts aren't working in a real roblox server, but they do work in roblox studio??

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

1 comment

0

Are these parts you want to be local and appear for each individual person 15 seconds after they join?

1 answer

✓ Accepted answer

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)

1 comment

0

Use the CharacterAdded event of plr instead of waiting for something with the name of the player in workspace.

This discussion is preserved as it was. New answers, comments, and votes are closed.