I didnt wanted to ask this at first cause its probally such an easy thing to do but i tried looking at yt and search here for the solution but i couldnt find anything… (but i may also just be blind) (Also this is my scripting Practice game where i try to learn scripting stuff…)
So i made an Part wich falls but then i wanted it to respawn so you dont have to restart the game but then i encountered this problem where the Part falls at first then respawns but when i try to do it again after that nothing happens. What cauld cause the Problem is that the “local” thing only works on the frist Part but not at the copied one cause its basically an different Part with the same name? I wanna know how i can make it that it goes by like the Name of the Part so even if it respawns it still works.
This is the Code (I can also post an Vid if needed)
local fallPart = game.ReplicatedStorage.FallPartA
local respawnPart = game.Workspace.Race.FallPartA
local function onTouch(humanoidPart)
local character = humanoidPart.Parent
local humanoid = character:FindFirstChildWhichIsA("Humanoid")
if humanoid then
respawnPart.Color = Color3.fromRGB(255,0,0)
wait(0.25)
respawnPart.Anchored = false
wait(5)
if not game.Workspace.Race:FindFirstChild("FallPart") then
fallPart:Clone().Parent = game.Workspace.Race
end
end
end
respawnPart.Touched:Connect(onTouch)