So I made a noclip script, but for some reason it breaks as soon as the player dies (which it shouldn't) Script is in a LocalScript in the playergui, with ResetPlayerGuiOnSpawn set to false.
Run, PlrChar, PlrHum, and NoClip are declared.
Anybody know the problem i'm at a complete loss.
Run.RenderStepped:connect(function() local Find = PlrChar:FindFirstChild("Humanoid") if (Find) then PlrHum = Find end if (NoClip) then PlrHum:ChangeState(Enum.HumanoidStateType.StrafingNoPhysics) end end)
I'd say it's because PlrChar doesn't get updated, but there is no way I could know that.
local PlrChar, PlrHum local NoClip = true local Run = game:GetService( "RunService" ) local player = game.Players.LocalPlayer player.CharacterAdded:connect(function(char) PlrChar = char end) while true do local Find = PlrChar:FindFirstChild("Humanoid") if (Find) then PlrHum = Find if (NoClip) then PlrHum:ChangeState(Enum.HumanoidStateType.StrafingNoPhysics) end end Run.RenderStepped:wait() -- RenderStepped used with connect is bad idea, since connect spawns new Lua threads every time it's fired. You could also try using BindToRenderStep. end
This should work, but again, I'm not sure what other part of your script is already doing.