Script that makes the player force walk when they fire a gun won't work

title says it all

game.ReplicatedStorage.ShootEvent.OnServerEvent:Connect(function(player)
	local character = player.Character or player.CharacterAdded:Wait()
	player.PlayerGui["Realism Mod"].Sprint.Enabled = false
	character:WaitForChild("Humanoid").WalkSpeed = 10
	wait(0.01)
	player.PlayerGui["Realism Mod"].Sprint.Enabled = true
end)

happens once and goes to sleep yet again

This is a example try if this works:

local player = game.Players.LocalPlayer
local character = player.Character
local humanoid = character:WaitForChild("Humanoid")
local sprint = player.PlayerGui["Realism Mod"].Sprint

game.ReplicatedStorage.ShootEvent.OnServerEvent:Connect(function()
	sprint.Enabled = false
	humanoid.WalkSpeed = 10
	wait(0.01)
	sprint.Enabled = true
end)

doesn’t work
looks like the same script with values

LUA Cannot make the player move, but it can influence the player’s movemet I believe that this is how LUA movement works. And I am also sorry about the code kinda my fault tho.

i was wondering how other fps games does it :skull:

They use C# or C++ if you mean games out of roblox, if you mean games in roblox they will just add velocity to your character and/or modify your movement or will throw you back.