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

How to make a Player and a NPC play animations when touching a part (revisited)?

Asked by 4 years ago
local Player = game:GetService'Players'.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Head = Character:WaitForChild("Head")
local nono = workspace.Them.Head
local Them = workspace.Them
local humanoid = Them.Humanoid 
---------------------------------

function onTouched(hit) 
local G = humanoid:LoadAnimation(nono.Die)
local anim = Player.Humanoid:LoadAnimation(Head.ShotByShotgun)  
wait(.01)
G:Play() 
anim:Play()
workspace.Touch.CFrame = CFrame.new(-27.385, -2.785, -5.89) 
wait(3)
workspace.SHOTGUN:Play()
end 
--------------------------------------

script.Parent.Touched:connect(onTouched)

Error: Workspace.Touch.Script:2: attempt to index nil with 'Character'

I don't understand.

0
Yes I had this question before, but I changed things up with some help and getting some errors. TheBuliderMC 84 — 4y

Answer this question