So I Have A script Which Removes Limbs Through A GUI But The Server Script Is Having A Nil Error And I Don't Know Why. How it works is That A Local Script Send Data Through An Event And The Server Script Receives the Data then Removes That Players Limb But There's A Nil Error.
The Error Is: Workspace.LimbLoss:9: attempt to call a nil value
This Is The Server Script:
game.ReplicatedStorage.LimRemover.LimRemoveData1.OnServerEvent:Connect(function(plr,Player)
game.ReplicatedStorage.LimRemover.LimRemoveData2.OnServerEvent:Connect(function(plr,Limb)
local pl = game.Players:GetPlayers(Player)
if pl then
if Limb then
if Limb == nil then
print("Error In LimbLoss Limb Is Nil")
else
Limb:Destroy() -- This Is The Error
end
end
else
print("Error In LimbLoss")
end
end)
end)
Local Script (In Gui):
script.Parent.TextButton.MouseButton1Click:Connect(function()
game.ReplicatedStorage.LimRemover.LimRemoveData1:FireServer(script.Parent.TextBox.Text)
wait(0.1)
game.ReplicatedStorage.LimRemover.LimRemoveData2:FireServer("Left Arm")
end)
