My script runs all this perfectly and prints all the prints that it needs too but if i reset my player, the script seems to print “lovely jubbly” then nothing it doesn’t carry on to the hello or anything past that. Does anybody know why this is?
remotes.SpawnPets.OnClientEvent:connect(function()
if petC.petEquipped then
print("lovely jubbly")
petC:EquipOnJoin(c)
else
print("stoopid doesn't exist")
end
print("hello")
local count = 0
for i,v in pairs(petC) do
count = count + 1
end
print(tostring(petC) .. " is the petC " .. tostring(count))
end)
the script also makes it to the final print on this module method so i cannot see where the problem occurs
function pets:EquipOnJoin(c)
if (isServer) then
print("server side")
local ToChange = 1
for i,v in pairs(self.petEquipped) do
if v ~= nil then
v:Destroy()
end
self.petEquipped[i] = nil
end
print("emptied the petEquipped")
for petKey,petData in pairs(self.petNameEquipped) do
local petName = petData.Name
self.petEquipped["Duck" .. tostring(ToChange)] = pStorage:FindFirstChild(petName):Clone()
self.petEquipped["Duck" .. tostring(ToChange)]:FindFirstChild("Head").Name = petKey
self.petEquipped["Duck" .. tostring(ToChange)].Parent = c
self.petEquipped["Duck" .. tostring(ToChange)].PrimaryPart.CFrame = c:FindFirstChild("HumanoidRootPart").CFrame + Vector3.new(10,10,10)
ToChange = ToChange + 1
end
print("made it to the end!")
else
print("client side")
self.petEquipped = remotes.EquipOnJoin:InvokeServer()
end
end