Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why wouldn't my Team-Only-Script work? It doesn't even say what's wrong on the output!

Why won't this work?

local PhysicalPlayer = game.Workspace:WaitForChild("player.Name")
local MentalPlayer = game.Players[player.Name]
local RLD = MentalPlayer.Backpack.RocketLauncher.Configurations.Damage

game.Players.PlayerAdded:connect(function(player)
	if game.Players[player.Name].Team == "Crimson" then 
		RLD.Value = 100
	end
end)

1 answer

In line 1, are you looking for an object that is literally named "player.Name"?

In line 6, the Team property of a Player holds a reference to the Team object, not a string. So add a .Name.

local PhysicaPlayer = game.Workspace:WaitForChild(player.Name)
 -- Remove the ""

game:GetService'Players'.PlayerAdded:Connect(function(plr)
    if plr.Team.Name == 'Crimson' then
        -- Do code 
    end
end)

1 comment

0

Alright thanks

This discussion is preserved as it was. New answers, comments, and votes are closed.