Problem with a Sprint script if you are in a Team

  1. What do you want to achieve?
    That when you are pressing shift, you are sprinting.

  2. What is the issue?
    There is no output massage and if you are in a team it does’t work.

  3. What solutions have you tried so far?
    Nothing because there is no output.

Sprint script in Staterplayerscripts

local inputService = game:GetService("UserInputService")
local plr = game.Players.LocalPlayer
local char = plr.Character or plr.CharacterAdded:wait()

local sprinting = false

--the script

--input began
	if key.KeyCode == Enum.KeyCode.LeftShift or key.KeyCode == Enum.KeyCode.RightShift then
		running = true
		if char.Humanoid then
			char.Humanoid.WalkSpeed = 22 --Players speed while sprinting

--input ended
	if key.KeyCode == Enum.KeyCode.LeftShift or key.KeyCode == Enum.KeyCode.RightShift then
		running = false
		if char.Humanoid then
			char.Humanoid.WalkSpeed = 16 --Players speed while sprinting

When i am in a team the sprint script does’t work. Except when you’re on the normal team.

The team assignment script that is on the server.

function onPlayerEntered(plr) 
	if plr.UserId == 12345678 -- Insert your UserId here; found at end of web address on your profile
	then plr.TeamColor ="Really black") plr:LoadCharacter() -- Places player with Id above onto team with this TeamColor
elseif plr.UserId == 12345678 -- This allows you to different people be placed on another team
	then plr.TeamColor ="Dark blue") plr:LoadCharacter()
elseif plr.UserId == 12345678 -- If player does not have either of these Ids, then they go to this team

	then plr.TeamColor ="Camo") plr:LoadCharacter()
	plr.TeamColor ="Institutional white") plr:LoadCharacter()


I am new to scripting. Thanks for your help.

Are you trying to set it so they are allowed to sprint if they are in a certain team?

You should be able to sprint in every team.

You didn’t set a variable for this, it should be sprinting.

Thanks for your helping. :grinning:

1 Like