(solved this by putting the script that clones combat into the starter pack, along with the events)

Ive got a text button that equips a tool when its clicked. it wont work for some reason. Here is a gyazo of how things are arranged.

LocalScript:

local Player = game.Players.LocalPlayer




function Give()
		script.Equip:FireServer()	
	end


script.Parent.MouseButton1Click:connect(Give)

Normal Script:

local Event = script.Parent.Equip



function Equiper(Player)
	if Player.Backpack:findFirstChild("Combat") then
	script.Parent.Parent.BackgroundColor3 = Color3.new(0,204,0)
		script.Parent.Parent.Text = "Equip"
	Player.Backpack.Combat:Remove()
	else
		script.Parent.Parent.BackgroundColor3 = Color3.new(70,0,0)
		script.Parent.Parent.Text = "Unequip"
	game.ReplicatedStorage.Combat:Clone().Parent = Player.Backpack
	end
end




Event.OnServerEvent:Connect(Equiper)

thanks for reading ^^

5 comments

0

Any errors?

0

use :Connect and :Destroy. :connect and :Remove are deprecated.

0

There's no errors at all :/

0

I got the gui part to work, but combat will not clone to the backpack, and if I copy combat and paste it to the backpack with studio, it wont remove it when i click the gui again, but the gui changes color and text like it's suppose to .-.

0

(gui part works cause I moved it to the local script)