#Need help please, trying to make wall disappear when it reaches spot then do it again infinite
1 messages · Page 1 of 1 (latest)
when it reaches target it just keeps going 🙁
Im not really a scripter but imma try to understand the script rq
So if I am correct, when the player takes damages, the wall need to be further ?
im trying to make it disappear on this white line
Oh then you need to add transparency and collision
Yeah but once you want to make the line disappear it need to be so that the player can’t collide with it
i want to make the wall disappear when it reaches that line
then reset it and do it just like u said a loop
Yea so you just need to put the wall transparency to 1
Then do a while loop if I am correct
think about just like that tsunami wave from the escape game

@tawny solstice
local template = script.Parent
local startCFrame = template.CFrame
-- SETTINGS
local targetPosition = Vector3.new(104.5, 21.914, -747.5) -- CHANGE THIS
local reachDistance = 3
local speed = 350
local respawnDelay = 1
while true do
-- CLONE WALL
local o = template:Clone()
o.CFrame = startCFrame
o.Parent = template.Parent
-- DAMAGE
local debounce = {}
o.Touched:Connect(function(hit)
local hum = hit.Parent:FindFirstChild("Humanoid")
if hum and not debounce[hum] then
debounce[hum] = true
hum:TakeDamage(60)
task.delay(1, function()
debounce[hum] = nil
end)
end
end)
-- MOVEMENT
local attachment = Instance.new("Attachment", o)
local velocity = Instance.new("LinearVelocity")
velocity.Attachment0 = attachment
velocity.MaxForce = math.huge
velocity.VectorVelocity = o.CFrame.LookVector * -speed
velocity.Parent = o
-- WAIT UNTIL IT REACHES TARGET
local reached = false
local connection
connection = RunService.Heartbeat:Connect(function()
if not o.Parent then
connection:Disconnect()
return
end
if (o.Position - targetPosition).Magnitude <= reachDistance then
reached = true
connection:Disconnect()
o:Destroy()
end
end)
-- WAIT BEFORE NEXT LOOP
repeat task.wait(1) until reached
task.wait(respawnDelay)
end```
the wall just keeps going. i want it to disappear once it reaches the target like a loop
print the distance every time
try to get the minimum distance
is it an easy fix? if so can u send what u mean
i dont know the root problem yet
but if you print the distance every heartbeat, you should try to look for the minimum distance when it hits the end
from the output
tryna make it disappear on that white line
if its a big wall, the distance will probably exceed the reach distance
yea just like escape tsunami waves
it will include the y axis if you use position
maybe
@exotic lotus
local distance = (Vector3.new(o.Position.X, 0, o.Position.Z) - Vector3.new(targetPosition.X, 0, targetPosition.Z)).Magnitude
if distance <= reachDistance then
reached = true
connection:Disconnect()
o:Destroy()
end
trying 