So, I attempted to make a script in a tool that lets the player using the tool go through walls, not floors. I have no clue and don't know what to do. Here is my code:
while true do
script.Parent.Torso.CanCollide = false
end
So, I attempted to make a script in a tool that lets the player using the tool go through walls, not floors. I have no clue and don't know what to do. Here is my code:
while true do
script.Parent.Torso.CanCollide = false
end
Since loops have no delay time without the wait function, that script will cause a script timeout / it will freeze your game for a period of time. So consider using another method.
I don't know why but Torso.CanCollide=true regardless if you change the property or not. So why not make the other part's CanCollide false?
I would add the walls you want to be collision-less in their own folder or have a value inside them for identification.
--local script
local walls = workspace["Walls Folder Here"]
script.Parent.Equipped:Connect(function()
for i, v in pairs(walls) do --Loops through each item in the walls folder
v.CanCollide = false --Sets their CanCollide property to false
end
end)
script.Parent.Unequipped:Connect(function()
for i, v in pairs(walls) do
v.CanCollide = true
end
end)
This discussion is preserved as it was. New answers, comments, and votes are closed.
1 comment
I have a question, I have no clue how to change the player who is using the tools stats, how would I? Would I need to keep doing script.Parent?