I wanna make fight game that push each others and wanted to make safe zone
1 Like
Do something like this:
local hitboxPart = --the part which is the safe zone
local function savePlayer(hit)
local humRootPart = hit.Parent:FindFirstChild("HumanoidRootPart")
humRootPart.CanTouch = false
humRootPart.CanQuery = false
end
local function unsavePlayer(hit)
local humRootPart = hit.Parent:FindFirstChild("HumanoidRootPart")
humRootPart.CanTouch = true
humRootPart.CanQuery = true
end
hitboxPart.Touched:Connect(savePlayer)
hitboxPart.TouchEnded:Connect(unsavePlayer)
Haven’t tested it so it might not work.
1 Like
CanTouch = true
just ignores any Touch / TouchEnded events connected to the part(s), as in those events won’t trigger at all when set to true.
CanQuery = true
determines whether the part is considered during spatial query operations, in this case it is not considered.
Got it! I’ll keep that in mind next time.
1 Like