https://gyazo.com/7d5b99979eb3e8cbd78e52ddf5409ec6
Hello, I am trying to make it where when a lava touches a spawnpoint, I am trying to make it where that spawnpoint gets destroyed
But my script does not work for some reason, I do not get errors or anything
sometimes to trigger the script, I need to die by the lava so that the spawnpoint gets destroyed
1 Like
workspace.Part:GetTouchingParts(function(part)
if part:IsA("SpawnLocation") then
print(part.name)
part:Destroy()
end
end)
lV0rd
(Tin)
May 28, 2023, 10:10pm
#3
local parts = workspace.Part:GetTouchingParts()
for i, v in ipairs(parts) do
if v:IsA("SpawnLocation") then
v:Destroy()
end
end
lV0rd
(Tin)
May 28, 2023, 10:11pm
#4
rewrote the code cuz there we some mistakes
I’ll test it out (15 characters)
1 Like
lV0rd
(Tin)
May 28, 2023, 10:12pm
#6
:GetTouchingParts() returns a table of all baseparts touching which part you selected.
it does not work should I add a while loop in this code?
It basically does the same bug that I am trying to encounter
lV0rd
(Tin)
May 28, 2023, 10:15pm
#9
i switched from pairs to ipairs, try it now
Great it wokrs now!
all I did is this
while true do
task.wait(2)
local parts = workspace.Part:GetTouchingParts()
for i, v in ipairs(parts) do
if v:IsA("SpawnLocation") then
print(parts.name)
v:Destroy()
end
end
end
reason why I added a while loop is because I want the lava to destroy the spawnpoints from all 4 teams
But thanks for helping out!
1 Like
system
(system)
Closed
June 11, 2023, 10:22pm
#11
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.