So this is my code;
Check.Checkit = function(player, open1, open2, frame, about)
if open1 == true and open2 == true then
if about == "Sword" then
for i, v in pairs(frame.ItemView:GetChildren()) do
EquipEvent:FireServer( "UnEquip", v, v.AttackScript.Animation.Id.Value)
end
elseif about == "Inv" then
if #player.PlayerGui.Inventory.Character.Sword:GetChildren() == 1 then
print("Something is currently equipped!")
else
frame.Parent = player.PlayerGui.Inventory.Character.Sword
frame.Size = UDim2.new(1,0,1,0)
frame.Position = UDim2.new(0.5,0,0.5,0)
for i, v in pairs(frame.ItemView:GetChildren()) do
local serial = v.Stats.Serial.Value
EquipEvent:FireServer( "Equip", v.Name, v.AttackScript.Animation.Id.Value, serial)
end
end
end
end
end
This the the script which fires the event, now before this script, a local script calls this module:
local Inv_Open = player.PlayerGui.Inventory.Inventory.Opened
local Char_Open = player.PlayerGui.Inventory.Character.Opened
local frame = script.Parent.Parent
script.Parent.MouseButton1Click:Connect(function()
if script.Parent.Parent.Parent.Name == "Sword" then
local clone = script.Parent.Parent:Clone()
script.Parent.Parent:Destroy()
clone.Parent = player.PlayerGui.Inventory.Inventory.Inventory
EquipEvent:FireServer("UnEquip")
Check.Checkit(player, Inv_Open.Value, Char_Open.Value, frame, "Sword")
elseif script.Parent.Parent.Parent.Name == "Inventory" then
Check.Checkit(player, Inv_Open.Value, Char_Open.Value, frame, "Inv")
end
end)
Now, after all of this when the server gets the event this is the script:
Event.OnServerEvent:Connect(function(player, state, item, animation, serial)
local char = player.Character or player.CharacterAdded:Wait()
local Humanoid = player.Character:FindFirstChildOfClass("Humanoid")
local bp = player.Backpack:FindFirstChild(item)
local charitem = char:FindFirstChild(item)
if state == "Equip" then
print(item)
Humanoid:EquipTool(bp)
char.Animate.toolnone:WaitForChild("ToolNoneAnim").AnimationId = "http://www.roblox.com/asset/?id="..animation
Update.UpdateWeapon(player, serial)
elseif state == "UnEquip" then
Update.UpdateWeapon(player, 0)
Humanoid:UnequipTools(charitem)
end
end
So now as you can see in the first script on line 4 it says ItemView is not a valid member of image label.
but as you can see later on in that script its the same line and that works? So I am not sure what the problem is there and also it says Argument 1 missing or nil
Which is this line:
local bp = player.Backpack:FindFirstChild(item)
in the third script. If someone can help me fix this issue, that would be appreciated.