Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to make a noclip ablilty?

Me and some friends are trying to make a boku no hero acadmia game i was wondering how to script press z to use and in 10 seconds you can walk in any walls than have a cooldown of 5 seconds before you may use. So to shorten that, by pressing z you can walk in walls like noclip for 10 seconds and then have a cooldown of 5 second

1 answer

✓ Accepted answer

If you have FilteringEnabled, you could try this in a local script inside StarterGui, where you would have a part in workspace called Floor that the player could walk on (to prevent them from falling through the baseplate)

local debounce = true
game:GetService("UserInputService").InputBegan:Connect(function(key,bool)
	if key.KeyCode == Enum.KeyCode.Z and debounce == true and bool == false then
		debounce = false
		local changedParts = {}
		for _,v in pairs(workspace:GetDescendants()) do
			if v:IsA("BasePart") and v.Name ~= "Floor" and v.CanCollide == true then
				v.CanCollide = false
				table.insert(changedParts,1,v)
			end
		end
		wait(10)
		for _,v in pairs(changedParts) do
			v.CanCollide = true
		end
		wait(5)
		debounce = true
	end
end)

Other options could be to use collision filtering, but you would need remote events to do this.

2 comments

0

K thank you :D

0

Mind helping me make some scripts.. I really have no idea on making magic games.

This discussion is preserved as it was. New answers, comments, and votes are closed.