Hey! Little intro, so I have made a basic working admin panel. Anyways I have been wondering, how do you make a noclip function? YT Has not been very helpful so I am asking here.
1 Like
You can do this two ways, you can either change the statetype of your humanoid OR you can do it my way and just turn off the collision of the part
Here is a quick script that I wrote for you, you can use it if you want to go off of it, I tried to write as many comments as possible so you can understand it
local button = script.Parent --This is the button that you click
local noclip = false
local runservice = game:GetService('RunService')
local player = game.Players.LocalPlayer --Getting the local player
button.MouseButton1Click:Connect(function() --Detects if player clicks the button
if noclip == true then
noclip = false
script.Parent.Text = "not noclipping"
else
noclip = true
script.Parent.Text = "noclipping"
end
end)
runservice.Stepped:Connect(function()
if player then
if noclip == true then --Detects if noclip is true
for i, v in pairs(player.Character:GetDescendants()) do
if v:IsA("BasePart") then --Detects if the part the player touches is a part
v.CanCollide = false --Turns off the parts collisions
end
end
end
end
end)
Learn more about HumanoidStateType here:
https://developer.roblox.com/en-us/api-reference/enum/HumanoidStateType