I want to make a trip brick that makes player fall but I only want it to work once for every player. More specific,I am making a zombie virus by heavily modifying a zarm. Now I want to make it so that when someone gets infected he falls to the ground for a few seconds but only once in his lifetime because when I test it zombies trip other zombies and it looks stupid so I want to make it only work once on every player and when the player resets or dies,he can then be tripped again. On my attempt to make it work I tried sticking some zarm lines into the code but failed,I know that "if cantouch = 0/1 then" lines do what I want but I can't seem to figure out how to do the same with this code,sorry but first few lines are in this part of the text and I did not know how to fix that:
b = script.Parent b.Touched:connect(function(hit) local c = hit.Parent if c then for _,h in next, c:GetChildren() do if h:IsA'Humanoid' and h.Health > 0 and h:GetState().Name ~= 'Physics' then local newscript = script.physics:Clone() newscript.Parent = c newscript.Disabled = false wait(10) if h.Parent then local newscript = script.gettingup:Clone() newscript.Parent = c newscript.Disabled = false end break end end end end)
You have to keep track of who touches it and refer back to it on a new touch
--leave this false if you want it to that the current player cant touch it more than once --change to true if the overall player can only touch it once local OnePlayerTouchPerSession=false local touch={} b = script.Parent b.Touched:connect(function(hit) local c = hit.Parent if c and c:FindFirstChild("Humanoid") and game.Players:GetPlayerFromCharacter(c) then local plr=game.Players:GetPlayerFromCharacter(c) for _,v in pairs(touch) do if v==(not OnePlayerTouchPerSession and c or plr) then return else table.insert(touch,(not OnePlayerTouchPerSession and c or plr)) end end for _,h in next, c:GetChildren() do if h:IsA'Humanoid' and h.Health > 0 and h:GetState().Name ~= 'Physics' then local newscript = script.physics:Clone() newscript.Parent = c newscript.Disabled = false wait(10) if h.Parent then local newscript = script.gettingup:Clone() newscript.Parent = c newscript.Disabled = false end break end end end end)