Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by
ali7682 17
6 years ago

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

0
Are these parts you want to be local and appear for each individual person 15 seconds after they join? RockerCaleb1234 282 — 6y

1 answer

Log in to vote
0
Answered by
Nowaha 459 Moderation Voter
6 years ago
Edited 6 years ago

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)
0
Use the CharacterAdded event of plr instead of waiting for something with the name of the player in workspace. GoldenPhysics 474 — 6y
Ad

Answer this question