Hello Developers
I’m not good at coding when it comes to non-ui. but my problem here is, how do i sync the walkspeed with the loading part? To elaborate more, here’s a video
As you can see, at first it’s perfect walkspeed. but at the end, i fell. i tried to make walk speed higher such as 17
, 18
, 18.5
, 18.75
, and 20
but in any time longer, i will fall as the same as 16 walk speed.
Original Script
local LastPos = Vector3.new(8.5, 0.5, -0.125)
local starting = false
local blockcount = 0
local start
start = script.Parent['0'].Touched:Connect(function()
starting = true
start:Disconnect()
end)
while true do
if starting then
blockcount += 1
local block = script.Parent['block']:Clone()
block.Name = blockcount
block.Transparency = 1
block.Position = LastPos+Vector3.new(5,-5,0)
block.Parent = workspace
LastPos += Vector3.new(5,0,0)
game:GetService('TweenService'):Create(block,TweenInfo.new(0.5),{Position=block.Position+Vector3.new(0,5,0);Transparency=0}):Play()
if script.Parent:FindFirstChild(blockcount-10) then
game:GetService('TweenService'):Create(script.Parent:FindFirstChild(blockcount-10),TweenInfo.new(0.5),{Position=script.Parent:FindFirstChild(blockcount-10).Position-Vector3.new(0,5,0);Transparency=1}):Play()
end
if script.Parent:FindFirstChild(blockcount-11) then
script.Parent:FindFirstChild(blockcount-11):Destroy()
end
end
wait(0.25)
end
I’ve tried
using Touched
function but it just adds multiple block at the same time then it won’t work anymore.
Touched Function Script
local LastPos = Vector3.new(8.5, 0.5, -0.125)
local starting = false
local blockcount = 1
local start
start = script.Parent[blockcount-1].Touched:Connect(function(hit)
if hit.Parent:FindFirstChild('Humanoid') then
blockcount += 1
local block = script.Parent['block']:Clone()
block.Name = blockcount
block.Transparency = 1
block.Position = LastPos+Vector3.new(5,-5,0)
block.Parent = workspace
LastPos += Vector3.new(5,0,0)
game:GetService('TweenService'):Create(block,TweenInfo.new(0.5),{Position=block.Position+Vector3.new(0,5,0);Transparency=0}):Play()
if script.Parent:FindFirstChild(blockcount-10) then
game:GetService('TweenService'):Create(script.Parent:FindFirstChild(blockcount-10),TweenInfo.new(0.5),{Position=script.Parent:FindFirstChild(blockcount-10).Position-Vector3.new(0,5,0);Transparency=1}):Play()
end
if script.Parent:FindFirstChild(blockcount-11) then
script.Parent:FindFirstChild(blockcount-11):Destroy()
end
end
end)