I would like to make a script where a certain team can have a shift to run ability, I have tried putting one together but it didn’t work!
This is what I have so far,
and it is supposed to only allow the Bright Red team to access the script though it allows everyone instead of just that one team for some reason. The script also enables a script bellow It which has the actual shift to run script which works.
Well, returning doesn’t return the whole script, so you’re origional function doesn’t do anything. Just do:
function onPlayerEntered(player)
if player.Team = game:GetService("Teams"):FindFirstChild("Team") then
player.CharacterAdded:Connect(function(char)
--Clone script over
end
end
end
game.Players.PlayerAdded:Connect(onPlayerEntered)
If I am correct I think the blue line means the word you put is undefined(sometimes.) If you say something like “char” and don’t have a “char” variable then it should have a blue line. I am not sure because I haven’t used light theme for a while and I am using dark theme.
Blockquote
or you can move:
"local s = script.SprintScript:Clone()
s.Parent = char
s.Disabled = false
"
above the “end)” on the line above it.
The reason for this is because the line with “char” that is underlined in blue does not know what char is. That is because the code block where it says what “char” is in “player.CharacterAdded:Connect(function(char)” is only defined in that code block so it would be undefined and not pass char through every code block. Like I said, you need to move the script part I put in quotes into the code block that defines char: the code block that starts with “player.CharacterAdded:Connect(function(char)” so it knows what char is. Sorry for the bad explaining, I don’t explain that well.