The title is self explanatory. How can i so it so the player can go through certain blocks?
I say certain blocks because if it’s jut all blocks the player will certainly go through the ground and die.
I also need to make it toggable.
Thanks!
The title is self explanatory. How can i so it so the player can go through certain blocks?
I say certain blocks because if it’s jut all blocks the player will certainly go through the ground and die.
I also need to make it toggable.
Thanks!
Just change the cancollide to false
Wouldn’t that just make the player fall off the ground and die
Edit: When i try manually doing it, it automatically sets itself back to true
Alright I’ll post code on how to make blocks walk-through
--Reference the block first
local myPart = script.Parent
-- Say if you want it to be walk-through or not
myPart.CanCollide = false
No it should be fine if you have a floor part which has it true.
You have to specify which block exactly
Just modify the blocks that you want players to pass through? You don’t need to make everything un-CanCollide
I mean, i need to make it toggable, so the player won’t just walk through the walls everytime, only when it is needed.
What is the point of that? Do you mean you want it to change ever so often?
Toggable with a button? If yes I can give an example
Can’t you just set the Parts you want to collide/non-collide on the client side…? A LocalScript
is used for the client view only, which can make certain players go through parts, while others can’t depending on the scenario
I need the player to walk basically through every wall in the world except the ground, it would be too much trouble to uncollide every part in the world and toggle that
Yes, localscripts would be the ideal, but as i said
Put this in a local scrip which will be inside a click detectort:
local myPart = PATHHERE
script.Parent.MouseClick:Connect(function()
myPart.CanCollide = not myPart.CanCollide
end)
Button or UIS, i’m still deciding on that.
Just make two collision group,“Floor” and “Player”. And set Floor to collide with Player but not Default. Then set Player to not collide with Default. And to toggle the player collision, just do
PhysicsService:CollisionGroupSetCollidable("Player", "Default", toggleBoolean)
Basically i need a script to make a player able to run through walls when wanted.
Yes collisions groups are your go to thing then Collision Filtering | Roblox Creator Documentation
You could maybe put all the parts that are WallParts in a Folder
, and again using a LocalScript
, get the children of all parts inside that said “Folder”, which would make all of the walls collision set to false/true
(Just noticed the other posts)
local WallParts = workspace.CollidedWalls
local ColissionButton = script.Parent
local NonColissionButton = script.Parent.OtherButton
ColissionButton.MouseButton1Down:Connect(function()
for _, Part in pairs(WallParts:GetChildren()) do
Part.CanCollide = true
end
end)
NonColissionButton.MouseButton1Down:Connect(function()
for _, Part in pairs(WallParts:GetChildren()) do
Part.CanCollide = false
end
end