Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by
Zottic 19
6 years ago

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)

Closed as Non-Descriptive by evaera

This question has been closed because its title or content does not adequately describe the problem you are trying to solve.
Please ensure that your question pertains to your actual problem, rather than your attempted solution. That is, you were trying to solve problem X, and you thought solution Y would work, but instead of asking about X when you ran into trouble, you asked about Y.

Why was this question closed?

1 answer

Log in to vote
1
Answered by 6 years ago
Edited 6 years ago

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)
0
Alright thanks Zottic 19 — 6y
Ad