I am trying to develop a movement system like some mobile games (need help to my script, not hard i think)

  1. What do you want to achieve? [Video + Script below this text] Hello, I am trying to develop a movement system similar to the game Subway Surfer and so many others, the player can only move on 3 locations (middle, right, and left) by moving his finger on a direction. The problem with my script is that the direction of the character is uneven, while normally each time the directions should be the same. Here when I turn left or right, sometimes the player is at location “A” and sometimes at location “B”, when he should always be at the same location. I put my script and a video. I can rephrase better, I’m French and I have trouble finding the right vocabulary to explain in English. Thanks

  2. What is your script + video?

plr.PlayerGui.ScreenGui.Deplacement.gauche.MouseEnter:Connect(function() 
--Player want to move to the left
	plr.PlayerGui.ScreenGui.Deplacement.Visible = false
	plr.PlayerGui.ScreenGui.Deplacement.droite.Visible = false
	plr.PlayerGui.ScreenGui.Deplacement.gauche.Visible = false
	humanoid.WalkSpeed = 200
	character.Humanoid:Move(Vector3.new(-500,0,-10)) --plr movement
	wait(0.12)
	humanoid.WalkSpeed = 16
	character.Humanoid:Move(Vector3.new(0,0,-100))
	plr.PlayerGui.ScreenGui.Deplacement.droite.Visible = true
	plr.PlayerGui.ScreenGui.Deplacement.gauche.Visible = true
end)

plr.PlayerGui.ScreenGui.Deplacement.droite.MouseEnter:Connect(function()
--Player want to move to the right
	plr.PlayerGui.ScreenGui.Deplacement.Visible = false
	plr.PlayerGui.ScreenGui.Deplacement.droite.Visible = false
	plr.PlayerGui.ScreenGui.Deplacement.gauche.Visible = false
	humanoid.WalkSpeed = 200
	character.Humanoid:Move(Vector3.new(500,0,-10)) --plr movement
	wait(0.12)
	humanoid.WalkSpeed = 16
	character.Humanoid:Move(Vector3.new(0,0,-100))
	plr.PlayerGui.ScreenGui.Deplacement.droite.Visible = true
	plr.PlayerGui.ScreenGui.Deplacement.gauche.Visible = true
end)

“A” and “B” resume that, the video can be ambiguous to my words. 3 right guiding lines all going forward, the player should have the ability to move on one of the 3 lines when he move
IMG_20220822_061424


Hi, I found a solution to all my problems. And concerning the touch Swip I use a much easier solution, probably games like Temple Run Subway Surfer and so many others use the same. I use UserInputService TouchService, brings up a GUI with transparent images, and as soon as I move my finger over one of the images then my character performs an action (4 images: jump, down, right, left)

2 Likes

Hello!
Can you please explain how you made it?
I’ve tried to make something similiar for week…