local rock = script.Parent:WaitForChild("newRock") -- help me with this line function onTouched(hit) local humanoid =hit.Parent:FindFirstChildWhichIsA("Humanoid") if humanoid ~= nil then print(humanoid) humanoid:TakeDamage(100) end end rock.Touched:Connect(onTouched)
the newrock is a clone and i want the rock variable to wait for the another clones, any help?
" the cloning script "
local rock = script.Parent.Part local function copyRock() local newRock = rock:Clone() newRock.Name = "newRock" newRock.Anchored = false newRock.Parent = script.Parent wait(5) newRock:Destroy() end while true do wait(1) copyRock() end
I'm not sure if this will work or not, but it's worth a try.
local rockSpawned = false local rock = script.Parent.newRock while rockSpawned == false do if rock then rockSpawned = true end wait(0.1) end
I believe this would make the script be stuck in a loop until "newRock" is cloned