Hi there, I have a script that passes a bomb to a player by parenting the bomb and it’s necessary parts to the user. The issue is, is that this only works once, meaning I can pass the bomb to a user, but they can’t pass the bomb to anyone else. How could I achieve this? I have an idea of running the function every time the user touches something valid, however I’ve kinda already done that in the function provided below.
Note: Part2 is the bomb and RandomPlayer is the selected player at the start of the script, which a random bomb is passed to.
humanoid.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Torso") and hit.ClassName == "Part" then
if not istouched then
istouched = true
local hittorso = hit.Parent:FindFirstChild("Torso")
local hithead = hit.Parent:FindFirstChild("Head")
local hithumanoid = hit.Parent:FindFirstChild("Humanoid")
RandomPlayer = hithumanoid.Parent
print(hit.ClassName)
Part0.Parent = hittorso
Part2.Parent = hittorso
WeldConstraint1.Part1 = hittorso
weld1.Part1 = hittorso
Part0.Orientation = hittorso.Orientation + Vector3.new(-90,0,0)
Part0.Position = hittorso.Position + Vector3.new(0,0,-0.75)
Part2.Position = hittorso.Position
beeping.Parent = hithead
beeped.Parent = hithead
explosionsfx.Parent = hithead
wait(3)
istouched = false
end
end
end)