In my game, when you equip your pet, it runs through the server first for an integrity check and then marks the pet as equipped or unequipped. When the server is done, it will fire the client again and the client equips or unequips the pet. However, when FireClient(plr, true)
is called from the server, it returns the player and… nil? This makes it so every equip or unequip request is treated as an unequip request. I just have no idea what is going on… Here is the code: (every unstated variable IS stated elsewhere in code)
Client:
current.Buttons.Equip.MouseButton1Click:Connect(function()
pfev:FireServer(true, current.SelectedPet.Value)
end)
pfev.OnClientEvent:Connect(function(dog,tof)
print(tof)
if tof then
pfm:AddPet(plr, string.gsub(current.SelectedPet.Value, "%d+", ""))
else
pfm:RemovePet(plr, string.gsub(current.SelectedPet.Value, "%d+", ""))
end
end)
Server:
pfev.OnServerEvent:Connect(function(plr, tof, csv)
if tof then
if csv == current.SelectedPet.Value then
local dogtag = Instance.new("BoolValue")
dogtag.Name = current.SelectedPet.Value
dogtag.Parent = plr.activepets
pfev:FireClient(plr, true)
else
plr:Kick("Invalid pet equip request")
end
else
--unfinished..
end
end)
If you need more code then I will happily send. Thanks!