Hello!
I’m making an equip system for my game(similar to Banana Eats), however it isn’t working correctly.
I can buy the skins, however when I click the equip trap button, the equippedtrap value changes but the text doesn’t. There are no errors.
Local Script:
local Item = script.Parent
local Player = game.Players.LocalPlayer
local ReplicatedStorage = game:GetService('ReplicatedStorage')
local Events = ReplicatedStorage:WaitForChild('Events')
Events.UpdateBackpack.OnClientEvent:Connect(function(SkinName)
print('fired')
if Player.OwnedTraps:FindFirstChild(SkinName) then
print('Is ready')
if Player.EquippedTrap.Value ~= Item.Name then
print('Changing to equip')
script.Parent.Price.Text = 'EQUIP'
else
print('changing to equipped')
script.Parent.Price.Text = 'EQUIPPED'
end
end
end)
script.Parent.Purchase.MouseButton1Click:Connect(function()
if script.Parent.Price.Text ~= 'EQUIP' then
if script.Parent.Price.Text ~= 'EQUIPPED' then
local BuyItem = Events.BuyItem:InvokeServer(Item.Name,Item.PriceValue.Value,'Trap')
if BuyItem then
workspace.CashOut:Play()
else
workspace.Error:Play()
end
end
end
if script.Parent.Price.Text == 'EQUIP' then
Events.EquipSkin:FireServer(true,Item.Name,'Trap')
end
end)
Server script:
local function EquipSkin(Player,EquipOrNot,SkinName,TypeOf)
if EquipOrNot then
if TypeOf == 'Skin' then
Player.EquippedSkin.Value = SkinName
wait(.3)
game.ReplicatedStorage.Events.UpdateBackpack:FireClient(Player,SkinName)
elseif TypeOf == 'Trap' then
print('Trap')
Player.EquippedTrap.Value = SkinName
wait(.3)
game.ReplicatedStorage.Events.UpdateBackpack:FireClient(Player,SkinName)
print('fired back')
end
end
end
Thanks for any help! I am not getting any errors at all!