game.ReplicatedStorage.Events.Sell.OnServerEvent:Connect(function(player, Coins, newitem)
player.Data.Coins.Value += Coins
if player.Character:FindFirstChildOfClass("Model") then
if newitem.Equipped.Value == true then --- Problem here
print("Model has been found")
player.Character:FindFirstChildOfClass("Model"):Destroy()
player.Data.Damage.Value -= player.Data.EquippedValue.Value
elseif newitem.Equipped.Value == false then
player.Data.Damage.Value -= player.Data.EquippedValue.Value
player.Character:FindFirstChildOfClass("Model"):Destroy()
end
end
end)
Most likely the item isn’t being replicated to the remoteevent probably due to the item being visible to a client only, meaning the server can’t see it, just fire in the value of Equipped and use that instead of trying to get the Equipped value from the server
game.ReplicatedStorage.Events.Sell.OnServerEvent:Connect(function(player, Coins, newitem)
player.Data.Coins.Value += Coins
if player.Character:FindFirstChildOfClass("Model") then
if newitem then
print("Model has been found")
player.Character:FindFirstChildOfClass("Model"):Destroy()
player.Data.Damage.Value -= player.Data.EquippedValue.Value
else
player.Data.Damage.Value -= player.Data.EquippedValue.Value
player.Character:FindFirstChildOfClass("Model"):Destroy()
end
end
end)