I am working on a game were the player will move a certain amount of studs based on how many clicks they have but it wont stop moving the player!
script.Parent.Parent.CountdownWall:Destroy()
db = false
script.Parent.Parent.hitPart.Touched:Connect(function(obj)
if obj.Parent:FindFirstChild("Humanoid") then
local plr = obj.Parent
local player = game.Players:FindFirstChild(plr.Name)
if player then
script.Parent.Swoosh:Play()
local stat = player:WaitForChild("leaderstats")
local power = stat.Power
if power.Value >= 0 then
plr.PrimaryPart.Anchored = true
if power.Value >= 5000 then
for i = 1, power.Value * 0.83 do
wait()
if db == false then
plr.PrimaryPart.Position += Vector3.new(0,0,12)
task.wait()
end
end
else
if power.Value >= 1000 then
for i = 1, power.Value * 0.14 do
wait()
plr.PrimaryPart.Position += Vector3.new(0,0,7)
task.wait()
end
else
for i = 1, power.Value * 0.5 do
wait()
plr.PrimaryPart.Position += Vector3.new(0,0,2)
task.wait()
end
end
end
plr.PrimaryPart.Anchored = false
stat.Money.Value += power.Value
wait(1)
plr.Humanoid.Health = 0
end
end
end
end)
script.Parent.Parent.hitPart.Touched:Connect(function(obj)
if obj.Parent:FindFirstChild("Humanoid") then
local plr = obj.Parent
local player = game.Players:FindFirstChild(plr.Name)
local stat = player:WaitForChild("leaderstats")
local power = stat.Power
if power.Value >= 10000 then
local number = power.Value / 10000
local floor = math.floor(number)
if floor >= 0 then
for i = 1, floor do
wait()
wait(26)
plr.PrimaryPart.CFrame = game.Workspace.Lobby.Main.Wall.TpStart.CFrame
task.wait()
end
end
end
end
end)