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

how to change walkspeed in this script when crouching???

Asked by
L30N_C 27
4 years ago

So i made a crouch script that makes you crouch. i got a idle animation as well when you aren't walking. i know how to change walkspeed but not where to put it in this script. Can somebody help me?

Here is the script:

ps i have a RemoteEvent that is named "OnCrouchBegun"

01local uis = game:GetService("UserInputService")
02 
03local crawlAnimation = script:WaitForChild("Crawl")
04local loadedCrawlAnim
05 
06local crawlIdle = script:WaitForChild("CrawlIdle")
07local loadedIdleAnim
08 
09local isCrawling = false
10 
11local humanoid = script.Parent:FindFirstChild("Humanoid")
12 
13 
14uis.InputBegan:Connect(function(key, gameProcessed)
15 
View all 59 lines...
0
You have to change the WalkSpeed property of Humanoid on the Server. Ziffixture 6913 — 4y
0
wait what? L30N_C 27 — 4y
0
You should add a remote event that triggers an event on the server then the server sets that players walk speed this is would @Ziffixture tired to explain fast marine5575 359 — 4y
0
do humanoid.WalkSpeed FrontsoldierYT 129 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

Rather than writing it as:

1game.StarterPlayer.CharacterWalkSpeed = 5

instead do (in the server script):

1player.Character.humanoid.Walkspeed = 5

Use a remove event that fires when you would normally have the speed change that goes into a local script. If you need to learn how they work this website will help. https://www.google.com/search?client=firefox-b-1-d&q=Roblox+Studio+Remote+events

Make sure you change this for the crawl, crouch, and when you go back to standing. Also, Make sure that it is in a Server Script. If this answered your question be sure to accept it. If something is the wrong comment and I'll try and figure it out.

0
well im bad at remote events like that. can u like type where i should put things? L30N_C 27 — 4y
Ad

Answer this question