I am trying to make a script that, when a player touches a part, will make the blocks that are in a specific folder become CanCollide true only for the specific player that touched the block. I tried using localscripts or trying to make a script in StarterPlayerScripts but they didn’t work.*
1 Like
In local script, you can add a .Touched event then use for loop to loop through the group of parts and turn their can collide off.
local partToTouch = part-to-touch
local fallingPartsModel = model-here
local db = false
partToTouch.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
if hit.Parent == game.Players.LocalPlayer.Character then
if db then return end
db = true
for i,v in pairs(fallingPartsModel:GetChildren()) do
v.CanCollide = false
end
end
end
end)
2 Likes
I have checked it and it is working, thank you very much.