Ok so here is the problem I made a script (input detector) for it to only work for a specific team and it worked but when the team was changed to another team the script would still work for them I need the script to stop working when the player goes to another team have any ideas? Any help is appreciated thanks! and here is the code (btw Jay is the name of the team) unless u rejoin the game in another team only then the script wouldnt work for you
game.Players.PlayerAdded:Connect(function(player)
wait(2)
if player.Team == game.Teams.Jay then
print("is on jay team")
player.Character.InputDetector.Disabled = false
end
end)
game.Players.PlayerAdded:Connect(function(player)
wait(2)
player:GetPropertyChangedSignal("Team"):connect(function()
if player.Team == game.Teams.Jay then
print("is on jay team")
player.Character.InputDetector.Disabled = false
end)
end
end)
I tried that now the script doesnt work at all it didnt work for either team probably because there is a small mistake in the script the output read
ServerScriptService.lightning only:7: Expected identifier when parsing expression, got ‘)’ - Studio - lightning only:7
game.Players.PlayerAdded:Connect(function(player)
wait(2)
player:GetPropertyChangedSignal("Team"):connect(function()
if player.Team == game.Teams.Jay then
print("is on jay team")
player.Character.InputDetector.Disabled = false
end
end)
end)
Try this very so slightly modified version of xXxIAsdasIxXx’s script
Ok so here are the results its confusing
the initial problem was that when teams were swiched the script will still work for both teams but with the edited script its the exact same thing but when u spawn on the Jay team the script didnt work until u switched sides to the Kai team then back to jay so no it didnt work im startin to lose hope is there any way to make team only scripts?
game.Players.PlayerAdded:Connect(function(player)
wait(2)
player:GetPropertyChangedSignal("Team"):Connect(function()
if player.Team == game.Teams.Jay then
print("is on jay team")
player.Character.InputDetector.Disabled = false
else
player.Character.InputDetector.Disabled = true
end
end)
end)
HOLY COW I THINK YOUR SCRIPT WORKED! Even I forgot else im such a noob after further testing I will mark you as solution is all goes well thanks so much!
I have a problem the script works but when we reset character on the same team it doesnt work we have to go and change the team again ie going to team kai then back to jay for the script to work any fix for that?
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(character)
if player.Team == game.Teams.Jay then
local inputDetector = character:FindFirstChild("InputDetector")
if inputDetector then
inputDetector.Disabled = false
end
end
end
player:GetPropertyChangedSignal("Team"):Connect(function()
if player.Team == game.Teams.Jay then
print("is on jay team")
player.Character.InputDetector.Disabled = false
else
player.Character.InputDetector.Disabled = true
end
end)
end)
complete failure the initial script itself stopped working but its a small fix here is the output
ServerScriptService.lightning only:10: Expected ‘)’ (to close ‘(’ at line 1), got ‘player’
probably a small error can u fix it please?
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(character) wait()
if player.Team == game.Teams.Jay then
local inputDetector = character:FindFirstChild("InputDetector")
if inputDetector then
inputDetector.Disabled = false
end
end
end
end)
player:GetPropertyChangedSignal("Team"):Connect(function()
if player.Team == game.Teams.Jay then
print("is on jay team")
player.Character.InputDetector.Disabled = false
else
player.Character.InputDetector.Disabled = true
end
end)
end)