I have a Local Script set up to fire a Remote Event with a variable attached to it to send to the Server Script that captures the event. The script works almost 100% of the time, but I am seeing that the variable shows up as nil rarely, and I cannot recreate it. This is happening in two different scripts:
Local Script:
speciestag:FireServer("Egg")
Server Script:
speciestag.OnServerEvent:Connect(function(player,species)
print(species)
if species == "Egg" then
rpname.Adornee = player.Character:FindFirstChildOfClass("Model"):WaitForChild("Middle")
end
end)
nil
The other script that this happens with shows me an error. I am mostly unable to recreate this and have only seen it happen when I get bug reports about it:
Local Script:
morph:FireServer("Egg")
Server Script:
morph.OnServerEvent:Connect(function(player,species)
repeat wait() until player.Character
local size = nil
local runvolume = nil
local runsoundspeed = nil
local pickup = false
if species == "Egg" then
size = .16
runvolume = 0
runsoundspeed = 1
pickup = true
end
AddBird (player,species,size,runvolume,runsoundspeed,pickup)
end)
function AddBird (player,species,size,runvolume,runsoundspeed,pickup)
if size < 0.5 then -- Error is here
h:WaitForChild("BodyWidthScale").Value= 0.6
h:WaitForChild("BodyDepthScale").Value= 0.6
else
h:WaitForChild("BodyWidthScale").Value= 1
h:WaitForChild("BodyDepthScale").Value= 1
end
--rest of script
end
Attempt to compare nil with number
Again, I am usually unable to recreate this and it only happens sometimes, but what would be the reason and what can I do to reduce this bug?
