i get error unable to cast value to object cuz i need to reference a player object but i have no idea what code to put in to make it do that also the error is at line 11
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
FireClient:() Doesnt ask for the player name but asks for the player itself. Try that if you can.