My position settings say the gui should not be on the screen and I want it like that but whenever I play the game the gui doesn't show up as a new text button in the starter gui Help.~~~~~~~~~~~~~~~~~ game.Workspace.Hill1.NamePlate.Touched:Connect(function(player) if player.claim == false then if game.Workspace.Hill1.Claimed.Value == false then local claim = Instance.new("TextButton", game.StarterGui.ScreenGui) claim.Position = UDim2.new(0.408, 0,0, -100)
end end
end)
~~~~~~~~~~~~~~~~~
You have a lot of problems with your script but I'm just gonna fix the main ones for you.
workspace.Hill1.NamePlate.Touched:Connect(function(hit) local player = game:GetService('Players'):GetPlayerFromCharacter(hit.Parent) if player ~= nil and player.claim.Value == false then if game.Workspace.Hill1.Claimed.Value == false then local claim = Instance.new("TextButton", player.PlayerGui.ScreenGui) claim.Position = UDim2.new(0.408, 0,0, -100) end end end)
First off .Touched passes whatever object touched it as an argument, not the player, so I just fixed that to actually get the player. You also were doing parenting the TextButton to StarterGui instead of the actual PlayerGui.
Hope this fixed your problem!
Sorry Here is how the code block should look like
game.Workspace.Hill1.NamePlate.Touched:Connect(function(player) if player.claim == false then if game.Workspace.Hill1.Claimed.Value == false then local claim = Instance.new("TextButton", game.StarterGui.ScreenGui) claim.Position = UDim2.new(0.408, 0,0, -100) end end end)
that block of code was in a local script Here is the script to insert the boolean value into the player (which works) it is a normal script