Hello, I have problem with SurfaceGui owner name tycoon. It should change name on gate from "Touch to claim!" on "Someone's Factory".

Can someone help me with this?

Here is script:

script.Parent.Head.Touched:connect(function(hit)
	local player = game.Players:GetPlayerFromCharacter(hit.Parent)
	if player ~= nil then
		local PlayerStats = game.ServerStorage.PlayerMoney:FindFirstChild(player.Name)
		if PlayerStats ~= nil then
			local ownstycoon = PlayerStats:FindFirstChild("OwnsTycoon")
			if ownstycoon ~= nil then
				if ownstycoon.Value == nil then
					if script.Parent.Parent.Parent.Owner.Value == nil then
						if hit.Parent:FindFirstChild("Humanoid") then
							if hit.Parent.Humanoid.Health > 0 then
								script.Parent.Parent.Parent.Owner.Value = player
								ownstycoon.Value = script.Parent.Parent.Parent
								script.Parent.Head.SurfaceGui.Change.Text = player.Name.."'s Factory"
								player.TeamColor = script.Parent.Parent.Parent.TeamColor.Value
							end
						end
					end
				end
			end
		end
	end
end)

Edit: I fortgot to add that there is auto assign to tycoon, so it should change automatically when player join to game.

3 comments

0

Is there any output?

0

Nope, it looks like script working, but won't change text.

0

Do us a favour, and put some prints in to see which conditions are truthy