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

Hmm DONOTREMOVE is not a valid member of workspace? on if workspace:FindFirstChild('DONOTREMOVE')

Asked by
4D_X 118
7 years ago

Here's the code. It's a anti exploit for a non fe cafe

D = workspace:FindFirstChild('DONOTREMOVE')
script.Parent = nil
workspace.DONOTREMOVE.Changed:Connect(function()
if D then
if workspace.DONOTREMOVE.Locked == false then
p = game.Players:GetChildren()
for i = 1,#p do
p[i]:Kick('Kicked because a exploiter has Un-Locked the workspace. For your safety, you have a been kicked. ~ Trol anti exploit')
end
end
end
end)
game.Lighting.Changed:connect(function()
game.Lighting.FogColor = Color3.new(191,191,191)
game.Lighting.FogEnd = "100000"
game.Lighting.FogStart = "0"
game.Lighting.OutdoorAmbient = Color3.new(127,127,127)
game.Lighting.Ambient = Color3.new(0,0,0)
game.Lighting.TimeOfDay = "10:00:00"
game.Lighting.Outlines = false
game.Lighting.GlobalShadows = true
game.Lighting.Brightness = 1
end)
workspace.Changed:connect(function()
if D then
print('Luckz')
else
m = Instance.new('Message')
m.Text = "Restoring map..."
m.Parent = workspace
MapBackUp = game.ServerStorage.MapBackup:Clone()
MapBackUp.Parent = workspace
game.ServerScriptService["DON'T TOUCH"].Disabled = true
wait(0.1)
game.ServerScriptService["DON'T TOUCH"].Disabled = false
wait(3)
m:Remove()
end
if workspace.Gravity >= 196.2 then
workspace.Gravity = 196.2
end
end)
--// Made by Trolna

1 answer

Log in to vote
0
Answered by
4D_X 118
6 years ago

Instead of :FindFirstChild(), use :WaitForChild('DONOTREMOVE'). What is happening is that the script is loading before everything else is. So, therefore, DONOTREMOVE has not loaded and is not in workspace yet. Using :WaitForChild() will make it so it will wait until DONOTREMOVE is in workspace and then continue on with the rest of the script.

0
I just realized I answered my own question... 4D_X 118 — 6y
Ad

Answer this question