So i’m working on a project where a ball drops and will kill a player if they touch it but I need it to return to the position I originally set for the part how do I do that? If that makes sense…
1 Like
Hey @HexticDev
to do this it should be quite simple.
Create who’s parent is the ball
local Ball = script.Parent
local OriginalBallPosition = Ball.CFrame -- if it's a model do Ball.PrimaryPart.CFrame
--[[
Function managing the ball drop
if Ball.CFrame = OriginalBallPosition then
Ball.Anchored = false
end
]]
-- Function fired when the ball hits the player
Ball.Touched:Connect(function(Hit)
if Hit:IsA("Humanoid") then
Hit.Health = 0
Ball.CFrame = OriginalBallPosition
end
end)
Should work. As soon as the player touches it, the player will die and the ball will return home and then fall again, creating a loop.
Let me know if there are any further questions!
1 Like
That’s you so much! I’ll try this when I get home!
1 Like