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

Why can't I delete the ControlScript in PlayerScripts?

Asked by
gdunn2 54
6 years ago

I don't understand... Can someone help me?

game.Players.PlayerAdded:connect(function(plr)
    wait(2)
    plr.PlayerScripts.ControlScript:Destroy()
end)

I don't get why this doesn't work. Although it works in singleplayer test, it does not work on a server. It says that PlayerScripts is not a valid member of player. That's why I have the wait(2). At first i did this:

game.Players.PlayerAdded:connect(function(plr)
    plr:WaitForChild("PlayerScripts"):WaitForChild("ControlScript"):Destroy()
end)

No idea why, but it also doesn't work. It just says possible infinite yeild and never deletes the control script. Maybe it is something simple I am overlooking, either way, help me out. Thanks!

0
Do you have filtering enabled on in workspace? shakran 23 — 6y
0
yes gdunn2 54 — 6y
0
that's the reason why Wilbob30 69 — 6y
0
Server-Side scripts cannot access PlayerScripts when fe is on. Thundermaker300 554 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

put a local script in Starter Player Scripts

wait(0.5)
local cs = script.Parent:WaitForChild("ControlScript")
cs:Destroy()

Should work lol

0
Accept this answer. AdvancedCode 136 — 6y
0
Another solution is to have a script named ControlScript inside StarterPlayerScripts; no code required. See here: http://wiki.roblox.com/index.php?title=API:Class/StarterPlayerScripts Unsubtleties 31 — 6y
Ad

Answer this question