Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Instead of going to the same position, it changes to where it went away at, help?

Asked by 7 years ago
print("LandMine Script Loaded")

local LandMine = script.Parent
local pos = game.Workspace.Meteor1.Position
local meteor = game.Workspace.Meteor1

function onTouched(hit)
  explosion = Instance.new("Explosion")
  explosion.BlastRadius = 20
  explosion.BlastPressure = 100000
  explosion.Position = script.Parent.Position
  explosion.Parent = game.Workspace
  script.Parent.Transparency = 0
  wait(.1)
  meteor.Parent = nil
  wait(2)
  meteor.Parent = workspace
  meteor.CFrame = CFrame.new(pos)
end

connection = LandMine.Touched:connect(onTouched)

So this is the script i used to make the meteor fall, touch the ground, explode, and in .1 second disappear, and then appear after 2 seconds. Only problem is that it doesn't go back to where it started from, it just starts appears lower and lower every time. Help?

0
I would recommend against setting the parent property to nil. I'd make transparency 1 and turn off CanCollide instead, to avoid issues with garbage collection in Lua. Plus, why are you setting the explosions parent to workspace instead of the land mine? GoldenPhysics 474 — 7y

Answer this question