Hey, I am a fairly new scripter so I just need someone to point me in the right direction here. I am making a script where when you click on a Text Button it will set your position to a part in the workspace. Any ideas?
local player = game.Players.LocalPlayer script.Parent.MouseButton1Click:Connect(function() player.Character:SetPrimaryCFrame(CFrame.new(____))--Set position here end)
You’d set this inside of a button’s Local script
This will work:
(insert this into a local script that’s in your GuiButton.)
--//Services local Players = game:GetService("Players") --//Variables local LocalPlayer = Players.LocalPlayer local Button = script.Parent local Part = workspace.Part -- Reference your part --//Functions Button.MouseButton1Click:Connect(function() print(LocalPlayer.Name, "has clicked the button.") LocalPlayer.Character:MoveTo(Part.Position) end)
Let me try this real quick. It looks like it should work.
It works, thank you very much for the help. Now I can get back to scripting :P.