this is the first script i have ever created. i thought i did pretty well. it doesn't work though, does anyone know why?
local player = game:GetService("Players").LocalPlayer -- Getting the local player
local char = player.Character or player.CharacterAdded:Wait() -- Waiting for character
local level = 0 -- The value for the player's level
local required = 1 -- The required level for the player (can be changed)
local guiButton = game.StarterGui.ScreenGui.TextButton -- The directory to the Gui TextButton
local goal = 43.55, 1.9, 106.9 -- The desired position, either A Vector3 or a CFrame
guiButton.MouseButton1Down:connect(function() -- If the gui button is pressed (left click)
if level < required then
return end
end)
if level >= required then
local hum = char:FindFirstChild("HumanoidRootPart")
hum.CFrame = goal (43.55, 1.9, 106.9) -- If CFrame
end

1 comment
for starts, you are using StarterGui instead of the localplayer's playergui