When i reset the character the script only prints up to line 18 which is Varaibles
i tried waiting for the character but it doesnt work help?
local plr = game.Players.LocalPlayer local char = plr.Character or plr.CharacterAdded:wait() local backpack = plr.Backpack local light = game.Lighting local safe = script.Parent.Parent:FindFirstChild('IsSafe') local deb = false script.Parent.MouseButton1Click:connect(function(press) if deb then return end deb = true print '1' local h = char:WaitForChild('Humanoid') local he = char:WaitForChild('Head') local n = plr.Name local ch = char:GetChildren() print 'Varaibles' if safe then if safe.Value == false then safe.Value = true print 'turning on safe mode' script.Parent.Text = "Turn Off Roleplay Mode" local to = backpack:GetChildren()--Takes tools inside a model in lighting Names it players Name store = nil for x = #to, 1, -1 do if (to[x]:isA("Tool")) then if store == nil then store = Instance.new("Model",light) end store.Name = "" ..plr.Name to[x].Parent = store end end print 'tools taken' h.MaxHealth = math.huge h.Health = math.huge elseif safe.Value == true then safe.Value = false script.Parent.Text = "Turn On Roleplay Mode" print 'turning off safe mode' --[[for x = #ch, 1, -1 do if (ch[x]:isA("Model")) then ch[x]:destroy() end end--]] h.MaxHealth = 100 h.Health = 100 he.Transparency = 0 local re = light:FindFirstChild("" ..plr.Name) if re then local ret = re:GetChildren() for i = #ret, 1, -1 do ret[i].Parent = backpack end end light["" ..plr.Name]:Destroy() print 'given back tools' end end wait(5) deb = false end)
On the bottom the h can be included. but the he is not. the code is here.
game.Workspace.("Example").Transparency = (Number) --Remember. the he is not included. game.Workspace is included. h.MaxHealth = 100 --Remember the math.huge is not gonna work. --same with h.Health.