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

How to make a noclip ablilty?

Asked by
Choobu 59
7 years ago

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

Log in to vote
0
Answered by
mattscy 3725 Moderation Voter Community Moderator
7 years ago

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.

0
K thank you :D Choobu 59 — 7y
0
Mind helping me make some scripts.. I really have no idea on making magic games. Choobu 59 — 7y
Ad

Answer this question