i am making it so that if some one is on construction team the can remove a certain part with a light on it i have been working on it for a long time and i think i could be almost done could anyone tell me what is wron with these two scripts
script#1
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.Value
local GiveTeamName = ReplicatedStorage:WaitForChild("GiveTeamName")
print('player who clicked is ' .. playerName)
wait(0.1)
GetAndGivePlayerName:FireClient(playerName)
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
script#2
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local GetAndGivePlayerName = ReplicatedStorage:WaitForChild("GetAndGivePlayerName")
local GiveTeamName = ReplicatedStorage:WaitForChild("GiveTeamName")
local playersTeam = game.Players.LocalPlayer.Team
local function onGavenPlayerName(playerName)
print("Incoming server event...")
print(playerName)
GiveTeamName:FireServer(playersTeam)
end
GetAndGivePlayerName.OnClientEvent:Connect(onGavenPlayerName)

1 comment
FireClient requires a Player Object as it reflects the connected Client. You're passing a name.