Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

parent is a nil value?

Asked by 5 years ago
Edited 5 years ago
script.DoAnim.OnServerEvent:Connect(function(anim,hum)
    script.ReturnEvent:FireAllClients()
    local heck = game.Lighting.PlayAnim:Clone()
    heck.yup.Value = anim
    heck.Parent = hum.Parent.Humanoid
    heck.Disabled = false
end)

error line 5 'attempt to index field "parent"(a nil value)'

0
Lighting should NOT be used as storage. User#19524 175 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

Anim is a nil value. Code correction: script.DoAnim.OnServerEvent:Connect(function(plr,anim,hum) You are calling the event as anim being the player calling the event. This leaves hum to be the animation. Adding plr and ignoring it will stop the code error.

0
Also, The event can only be called through a LocalScript. Use BindableEvents for Server to Server interaction. chexburger 358 — 5y
Ad

Answer this question