How do I teleport A part to the player once pressed on a GUI

local Player = game.Players.LocalPlayer.Character

	script.Parent.MouseButton1Click:Connect(function()

	game.Workspace.GammaB:Play()
	game.Workspace.GammaB2:Play()
	game.Workspace.Gamma.GammaBeam.Enabled = true
	game.Workspace.Gamma.GammaBeam1.Enabled = true
	game.Workpace.Gamma.Position = Vector3.new(Player.LeftFoot.Position)

	game.Workpace.Gamma.Position = game.Workspace.Gamma.Position + Vector3.new(3, 0, 0)
	wait(5)

	game.Workspace.GammaB1:Play()
	wait(27)
	game.Workspace.Gamma.GammaBeam.Enabled = false
	game.Workspace.Gamma.GammaBeam1.Enabled = false

	game.Workspace.GammaB:Stop()()
	game.Workspace.GammaB2:Stop()()
	game.Workspace.GammaB1:Stop()()


end)

game.ReplicatedStorage.RemoteEvent:FireServer()

The part is Game.Workspace.Gamma how do i teleport this part to the player when I press

You made a typo(it’s Workspace not Workpace) also you can type workspace Instead of game.Workspace.

Yeah but the script still doesn’t work

The game is inside of R15, right?
Also you can probably try teleporting it to the HumanoidRootPart instead of the foot.

local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Head = Character:WaitForChild("Head")

local RS = game:GetService("ReplicatedStorage")
local RE = RS:WaitForChild("RemoteEvent")

local Button = script.Parent
local GammaB = workspace:WaitForChild("GammaB")
local GammaB1 = workspace:WaitForChild("GammaB1")
local GammaB2 = workspace:WaitForChild("GammaB2")
local Gamma = workspace:WaitForChild("Gamma")
local GammaBeam = Gamma:WaitForChild("GammaBeam")
local GammaBeam1 = Gamma:WaitForChild("GammaBeam1")

Button.MouseButton1Click:Connect(function()
	GammaB:Play()
	GammaB2:Play()
	GammaBeam.Enabled = true
	GammaBeam1.Enabled = true
	Gamma.Position = (Head.Position - Vector3.new(2, 0, 0))
	task.wait(5)
	GammaB1:Play()
	task.wait(27)
	GammaBeam.Enabled = false
	GammaBeam1.Enabled = false
	GammaB:Stop()
	GammaB2:Stop()
	GammaB1:Stop()
end)

RE:FireServer() --whats the purpose of this? ill leave it here anyway

A couple of things, “Gamma1” wasn’t defined when you attempted to call the “:Play()” method through it, I’ve attempted to define it myself, the method “:Stop()” does not need to be called with an additional pair of enclosing parentheses, I’ve changed the position from the LeftFoot to the Head of the character as “Head” is a joint which exists for both R6 and R15 avatars. I’ve also declared everything outside of the callback function connected to the mouse click event to prevent the same variables being redeclared with the same values/same references to the same instances.

you do know we should help them edit it and not just send the edited code?

Doesn’t work because gammab1 and gmmab2 are audio

local GammaB = workspace:WaitForChild("GammaB")
local GammaB1 = workspace:WaitForChild("GammaB1")
local GammaB2 = workspace:WaitForChild("GammaB2")
local Gamma = workspace:WaitForChild("Gamma")
local GammaBeam = Gamma:WaitForChild("GammaBeam")
local GammaBeam1 = Gamma:WaitForChild("GammaBeam1")

Could you describe what each of these are? And provide any errors messages in console as that would be helpful.

local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Head = Character:WaitForChild("Head")

local Button = script.Parent
local Gamma = workspace:WaitForChild("Gamma")

Button.MouseButton1Click:Connect(function()
	Gamma.Position = (Head.Position - Vector3.new(2, 0, 0))
end)

On second note, I’ll let you add the rest in. This will move a part named “Gamma” in the workspace to the character upon a Gui button being clicked, which is what you needed assistance with.