i have sent the code in my newest message.
while true do
task.wait(1)
game.Workspace.Part.Touched:Connect(function(part)
if part:IsA("SpawnLocation") then
part:Destroy()
end
end)
end
You should set up the event listener before the while
loop, not inside of it. The listener is not Wait()
or Once()
, it’s Connect()
. So, it will keep running; the event detection isn’t a one-time occurence. This means that you don’t have to keep setting up the event if it doesn’t fire.
The issue may be that you are waiting to set up the event, and the SpawnLocation
is already touching the “lava”, so it won’t fire. If this isn’t your problem, is there any yield before the Touched
event listener?
Are you Able to give an example?
Yes. An example of where to put the event listener? Or an example of what your current code is doing?
The Event Listener Please I don’t understand
OK. I mean you should do this…
-- The event listener is set up before the `while` loop.
workspace.Part.Touched:Connect(function(part)
-- ...
end)
-- Don't include the `while` loop if it's not needed anymore.
…instead of this:
while true do
task.wait(1)
-- Setting up the event listener inside the `while` loop.
game.Workspace.Part.Touched:Connect(function(part)
if part:IsA("SpawnLocation") then
part:Destroy()
end
end)
end
Yes. The amount of characters I need is at least 30.
Ok we tried this but it ended with nothing
OK. Is the “lava” already in contact with the SpawnLocation
?
When the game starts Please explain?
Yes, when the game starts. Also, if I like your post, it means I am saying yes.
Oh ok, No when the game starts the lava slowly rises every 3 seconds
Are you using CFrame? If so, the .Touched event won’t fire
to move the lava up? i need 30
local teams = game:GetService("Teams"):GetChildren()
local model = game.Workspace.Doomspire
local messageText = ("regenerating")
local debris = game:GetService("Debris")
local backup = model:clone()
local screen = game.StarterGui.Notifications.Frame2.TextLabel
while true do
wait(3)
script.Parent.Position += Vector3.new(0,10,0)
end
I’ve already found a error with this, () aren’t needed, just do local messageText = regenerating
and it should work the same, if not better.
Thanks boo u found a little bug!