Your ends… at the last end, at a close parenthesis. Then at the second last end, remove the closing parenthesis. Then delete the third last end.
It’ll look something like this :
Part.Touched:Connect(function(Hit)
if Hit.Parent:FindFirstChild("Humanoid") then
script.Parent.BillboardGui.TextLabel.Text = (Hit.Parent.Name .. "'s Programming Base!")
claimed = true
else
--Whatever you gotta do here...
end
end)
local claimed = false
local name = script.Parent.BillboardGui.TextLabel
local currentPlayer = Instance.new('StringValue') -- Current player who owns tycoon
currentPlayer.Parent = script.Parent
script.Parent.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild('Humanoid') ~= nil then
if claimed == false then
claimed = true
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
name.Text = player.Name.."'s Programming Base!"
currentPlayer.Value = player.Name
end
end
end)
-- Setting up a PlayerRemoving event can check if the player left and then clear the tycoon
game.Players.PlayerRemoving:Connect(function(player)
if currentPlayer.Value == player.Name then
currentPlayer.Value = nil
claimed = false
name.Text = 'Claim'
end
end)
No, PlayerRemoving is its own event and not a remote event. You can just leave it as is.
Also replace the touched event with this, let me know if it works:
script.Parent.Touched:Connect(function(hit)
if claimed == false then
if hit.Parent:FindFirstChild('Humanoid') ~= nil then
claimed = true
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
name.Text = player.Name.."'s Programming Base!"
currentPlayer.Value = player.Name
end
end
end)
if you make it so that when the part is touched it teams the player to lets say red team if you then do script.Disabled = True then it shouldn’t let any other players get teamed red. It would also be a good idea to turn the collision off and part.visible = false. Tell me if this doesn’t work so I can do some tests on it to try fix it. I am not certain how to change the team but I think you an use Player.Team = Team name this might not be the case though.