You don't appear to be doing anything that would normally wrong except for you not accounting for Experimental Mode is off, meaning anything done on client does not necessarily reach the server. I suggest you read up on Remotes so you can properly modify your script.
**First, I hope you are using a local script, if so please change line 2 into local char = game.Player.LocalPlayer.CharacterAdded:wait() **
I suggest using a RemoteEvent, on line 6 you should replace your code with:
RemoteEvent:FireServer()
Due to your desire to sprint, you don't need to pass any arguments to pick a speed because it should be a set amount you can change on the server.
Now you need a server script with the following code:
RemoteEvent.OnServerEvent:Connect(function(Player)
if Player.Character.Humanoid.Health > 0 then
Player.Character.Humanoid.WalkSpeed = 30
end
end
All you need to do after this point is to be sure you create a way to slow your character down when they are done sprinting and to make RemoteEvent a variable or a directory to the RemoteEvent you are using.
3 comments
It appears your char variable is not pointing towards the Character model, but just the player.
That has been fixed.
Sorry I should of mentioned I do have a custom character, it's a standard R15 character (not a custom model).