I checked and when I press a button on a surface gui it clones the tool to my backpack, scripts and all, but when I equip it, it fails to work. When I put it in startergui, it works perfectly fine. What is going on here?

local Tool = script.Parent.Parent:WaitForChild("Cheeseburger")

function onActivated()
	Tool.GripForward = Vector3.new(-.981, .196, 0)
	Tool.GripPos = Vector3.new(-.5, -0.6, -1.5)
	Tool.GripRight = Vector3.new(0, -0, -1)
	Tool.GripUp = Vector3.new(0.196, .981, 0)
	
	print (Tool.Parent)

	wait(.8)

	Tool.GripForward = Vector3.new(-1, 0, 0)
	Tool.GripPos = Vector3.new(-.5, -.1, 0)
	Tool.GripRight = Vector3.new(0, 0, 1)
	Tool.GripUp = Vector3.new(0,1,0)
	
	script.Parent:Destroy()

end

script.Parent.Activated:connect(onActivated)

Here is the giving script:

local m = workspace.Menu
local s = m.SurfaceGui
local f = s.Frame
local cb = f.Cheeseburger
local p = f.Pasta
local tu = f.Turkey
local r = game:GetService("Lighting")
local c = r.Cheeseburger
local t = r.Turkey
local ma = r.Pasta

cb.MouseButton1Down:Connect(function()
	local c2 = c:Clone()
	c2.Parent = game.Players.LocalPlayer.Backpack
	print(c2.Parent)
end)

p.MouseButton1Down:Connect(function()
	local c2 = ma:Clone()
	c2.Parent = game.Players.LocalPlayer.Backpack
	print(c2.Parent)
end)

tu.MouseButton1Down:Connect(function()
	local c2 = t:Clone()
	c2.Parent = game.Players.LocalPlayer.Backpack
	print(c2.Parent)
end)

4 comments

0

Could you provide the giving script?

0

Ok, i've provided them, even though they work fine

0

is the tool script a server script

0

yep