Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

parent is a nil value?

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)'

1 comment

0

Lighting should NOT be used as storage.

1 answer

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.

1 comment

0

Also, The event can only be called through a LocalScript. Use BindableEvents for Server to Server interaction.

This discussion is preserved as it was. New answers, comments, and votes are closed.