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

how do i get a player object?

Asked by 3 years ago

i get error unable to cast value to object cuz i need to refrence a player object but i have no idea what code to put in to make it do that

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local Team = game:GetService("Teams"):WaitForChild("Construction")
local GetAndGivePlayerName = ReplicatedStorage:WaitForChild("GetAndGivePlayerName")
local playerName = script.Parent.RecentClickPlayerName
local player = Players:FindFirstChild(playerName.Value)

local GiveTeamName = ReplicatedStorage:WaitForChild("GiveTeamName")
print('player who clicked is ' .. playerName.Value)
wait(0.1)
GetAndGivePlayerName:FireClient(playerName.Value)
wait(0.1)
local function onGavenTeamName(playersTeam)
    if script.run.Value == true then
        if playersTeam == Team then
            print(playersTeam)
            print("player is on construction")
            script.Parent.broken.Value = false
        else
            print("player is not on construction")
            script.Parent.DisableEnableScript.runDisable.Value = true
            script.Parent.DisableEnableScript.runEnable.Value = false
        end
    end
end



0
also it is a server script jeremqpmfpi 41 — 3y
0
On what line is the error? ColdFoxy07 76 — 3y
0
And where is the script? ColdFoxy07 76 — 3y
0
Not enough context to find a solution for you. Please elaborate, provide where in the code you are experiencing the error. BunnyFilms1 297 — 3y
0
on line 8 jeremqpmfpi 41 — 3y

Answer this question