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

cannot cast value to object?

Asked by 3 years ago

i already asked this question and i did get an answer but i am still having trouble soo...

i am supposed too put in a player object into line 9 instead of a player name but i don't know how

2 answers

Log in to vote
0
Answered by 3 years ago

i forgot to add the code

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 GiveTeamName = ReplicatedStorage:WaitForChild("GiveTeamName")
print('player who clicked is ' .. playerName.Value)
wait(0.1)
GetAndGivePlayerName:FireClient(player)
print(playerName)
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



Ad
Log in to vote
0
Answered by
Amiaa16 3227 Moderation Voter Community Moderator
3 years ago

You never define player

Put this before the call

local plauer = Players:FindFirstChild(playerName.Value)

Answer this question