Not entirely sure what is going on here but I get this error.
Players.DevRhy.PlayerGui.ScreenGui.TextButton.Script:15: attempt to index number with 'Character'
my script is:
function part(head) local X = head.Position.X local Y = head.Position.Y local Z = head.Position.Z local posAboveHead = Vector3.new(X, Y + 5, Z) local part = Instance.new("Part") part.Parent = workspace part.Position = posAboveHead end script.Parent.MouseButton1Up:Connect(function(plr) local char = plr.Character or plr.CharacterAdded:wait() local head = char.Head part(head) end)
The MouseButton1Up event doesn't return the player that clicked it. It returns the mouse's x and y screen coordinates.
I'd recommend using a local script and fire a Remote Event if needed. Or, if you don't want to use Remote Events for some reason, you could use script.Parent's in a server script until you reach the player.