Movement System - I am completely new

Hello, I am completely new to Scripting, and the Forum if I did something wrong I am sorry, now I’ve just copied a Script from Youtube, because I don’t know anything yet, however I have some problems and I hope I get help here.

First thing is that the running animation dose not play when I run, I don’t have animations for the dashing yet but that shouldn’t stop the running animation, right?

Second thing is that I seem to slide a bit in a specific angle

I’ve tried some things (own changes in the code) but always put the original back, cuz my idea didn’t work, and I don’t know what I tried, I forgot it because I had to read this Forum to post my question

Did a Screen Recording but it was too big, so I hope that the script alone helps

The Scripts:

StaterPlayer → StaterPlayerScripts → MovementScript

local UIS = game:GetService("UserInputService")
local MovementEvent = game.ReplicatedStorage:WaitForChild("MovementEvent")
local Player = game.Players.LocalPlayer
local DashDirection = ""

UIS.InputBegan:Connect(function(Input, processed)
	if Input.UserInputType == Enum.UserInputType.Keyboard and not processed then
		if Input.KeyCode == Enum.KeyCode.LeftControl then
			Player.Character.Humanoid.WalkSpeed = 30
		elseif Input.KeyCode == Enum.KeyCode.W or Input.KeyCode == Enum.KeyCode.A or Input.KeyCode == Enum.KeyCode.S or Input.KeyCode == Enum.KeyCode.D then
			DashDirection = Input.KeyCode.Name
		elseif Input.KeyCode == Enum.KeyCode.C and Player.Character.IsRunning.Value == true then
			MovementEvent:FireServer("Dash", DashDirection)
		end
	end
end)

UIS.InputEnded:Connect(function(Input, processed)
	if Input.UserInputType == Enum.UserInputType.Keyboard and not processed then
		if Input.KeyCode == Enum.KeyCode.LeftControl then
			Player.Character.Humanoid.WalkSpeed = 12
		end
	end
end)

ServerScriptService → DashMovement-Server

local DS = game:GetService("Debris")
local SS = game:GetService("SoundService")
local MovementEvent = game.ReplicatedStorage:WaitForChild("MovementEvent")

game.Players.PlayerAdded:Connect(function(plr)
	plr.CharacterAdded:Connect(function(Character)
		local CanDash = Instance.new("BoolValue", Character)
		CanDash.Name = "CanDash"
		CanDash.Value = true
		local IsRunning = Instance.new("BoolValue", Character)
		IsRunning.Name = "IsRunning"
		IsRunning.Value = false

		Character.Animate.idle.Animation1.AnimationId = "http://www.roblox.com/asset/?id=129355562064083"
		Character.Animate.run.RunAnim.AnimationId = "http://www.roblox.com/asset/?id=99806970147725"
		Character.Animate.walk.WalkAnim.AnimationId = "http://www.roblox.com/asset/?id=77456603452990"

		Character.Humanoid.Running:Connect(function(Speed)
			if Speed > 13 then
				Character.IsRunning.Value = true
			else
				Character.IsRunning.Value = false
			end
		end)
	end)
end)

MovementEvent.OnServerEvent:Connect(function(plr, eventtype, Arg1)
	local Character = plr.Character

	if eventtype == "Dash" and Character.CanDash.Value == true then
		Character.CanDash.Value = false
		local BV = Instance.new("BodyVelocity", Character.HumanoidRootPart)

		delay(2, function()
			Character.CanDash.Value = true
		end)

		local DashDirection = Arg1
		local Attachment = Instance.new("Attachment", Character.HumanoidRootPart)
		local LinearVelocity = Instance.new("LinearVelocity", Attachment)
		local Part = Instance.new("Part", workspace)
		Part.Anchored = true
		Part.Transparency = 1
		Part.CanCollide = false

		local Multiplyer

		if DashDirection == "W" then
			Multiplyer = CFrame.new(-1, -1, -20)
		elseif DashDirection == "A" then
			Multiplyer = CFrame.new(-20, -1, -1)
		elseif DashDirection == "S" then
			Multiplyer = CFrame.new(-1, -1, 20)
		elseif DashDirection == "D" then
			Multiplyer = CFrame.new(20, -1, -1)
		end

		local AT = Character.Humanoid.Animator:LoadAnimation(script[DashDirection.."DashAnimation"])
		AT:Play()
		SS.Dash:Play()

		Part.CFrame = Character.HumanoidRootPart.CFrame * Multiplyer

		LinearVelocity.MaxForce = 99999
		LinearVelocity.VectorVelocity = (Part.Position - Character.HumanoidRootPart.Position).Unit * Vector3.new(100, 0, 100)
		LinearVelocity.Attachment0 = Attachment

		DS:AddItem(Attachment, 0.1)
	end
end)

is the running animation yours or does the youtuber own it, if u dont understand me, did u make a new running animation or did u just copy paste the script

2 Likes

I made some animations, two idles, the walk, the run and a fall animation, that should be all the animations that I did

2 Likes

um do u have an animation script

1 Like

Do you have any errors? Try reuploading the animations and putting the animation id’s in the client instead of the server.

Also can you clarify what you mean by the player sliding to a specific angle?

1 Like

The running animation Character.Animate.run.RunAnim.AnimationId = "http://www.roblox.com/asset/?id=99806970147725". isn’t the running animation you think it is, if the walk speed is above 10 the runAnim will be used instead of the walk one.

so first replace the run animation with the walk one
old-
Character.Animate.run.RunAnim.AnimationId = "http://www.roblox.com/asset/?id=99806970147725"Character.Animate.run.RunAnim.AnimationId = "http://www.roblox.com/asset/?id=77456603452990"

and to make the running animation you’d have to play the running animation when the player runs

local anim = Player.Character.Humanoid.Animator:LoadAnimation("http://www.roblox.com/asset/?id=99806970147725"

UIS.InputBegan:Connect(function(Input, processed)
	if Input.UserInputType == Enum.UserInputType.Keyboard and not processed then
		if Input.KeyCode == Enum.KeyCode.LeftControl then
			Player.Character.Humanoid.WalkSpeed = 30 
			anim:Play()
		elseif Input.KeyCode == Enum.KeyCode.W or Input.KeyCode == Enum.KeyCode.A or Input.KeyCode == Enum.KeyCode.S or Input.KeyCode == Enum.KeyCode.D then
			DashDirection = Input.KeyCode.Name
		elseif Input.KeyCode == Enum.KeyCode.C and Player.Character.IsRunning.Value == true then
			MovementEvent:FireServer("Dash", DashDirection)
		end
	end
end)

UIS.InputEnded:Connect(function(Input, processed)
	if Input.UserInputType == Enum.UserInputType.Keyboard and not processed then
		if Input.KeyCode == Enum.KeyCode.LeftControl then
			Player.Character.Humanoid.WalkSpeed = 12
			anim:Stop()
		end
	end
end)

p.s. i suggest using contextactionservice instead of UIS

Sorry that I didn’t reply for days, but with which script do I have to replace with yours? The first or the second? and like I don’t even know contextactionservice so I don’t know what to do with that.

Well I thank you silver4804 but I still need help if someone has ideas or knows what I have to put where then please help me, thank you.