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

How to fix move script?

Asked by 9 years ago

Hello, I want to make a script, when player touch part then he can't stop. I mean he will still moving forward.

Here is my code, maybe will help something:

local m = game.Players:GetPlayerFromCharacter(script.Parent):GetMouse()
local p = 0
local r = false

function onTouch()
    coroutine.resume(coroutine.create(function()
m.KeyDown:connect(function(key)
if key:lower() == "w" then p = p + 0
delay(0.5,function()
if p ~= 0 then p = 0 end
end)
if p == 0 then p = 0
r = true
m.KeyUp:connect(function(key)
if key:lower() == "w" then r = false end
end) end end end) end ))

end

script.Parent.Touched:connect(onTouch)

I'm beginner scripter, so i still don't understand a lot...

Answer this question