I asked this before, but it is not doing what I want it to do. When I click the "Push" part, it doesn't even go down to the position I provided. Also, the ParticleEmitter didn't get enabled either. Here is the script:
-- Push up = -154.205, 22.023, -13.131
-- Push down = -154.205, 21.343, -13.131
push = game.Workspace.Pump.Push
air = game.Workspace.Pump.PumpOut.ParticleEmitter
debounce = false
pumpon = false
function onClicked()
if debounce then return end
debounce = true
if pumpon then
pumpon = true
push.Position = Vector3.new(push.CFrame.X, 21.343, push.CFrame.Z) -- See below
air.Enabled = true
wait(1)
air.Enabled = false
else -- Your expression was redundant and likely a typo
pumpon = false
-- push.Position = push.CFrame(push.CFrame.X, 22.023, push.CFrame.Z)
-- Needs to be a Vector3 for Position.
push.Position = Vector3.new(push.CFrame.X, 22.023, push.CFrame.Z)
-- Alternatively,
-- push.CFrame = push.CFrame(push.CFrame.X, 22.023, push.CFrame.Z)
end
debounce = false -- You forgot to disable the debounce after the movement
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)

1 comment
Thanks for helping me man. It worked!