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.
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.