I’ve had the idea for my horror game if Character step on a part , it plays a animation. Instead it give this error
![]()
1st script located in StarterCharacterScript
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local character = player.Character or player.character:wait()
local humanoid = character:WaitForChild("Humanoid")
local canTouch = false
local PlayerAnimationFeedback = require(ReplicatedStorage):WaitForCHild("PlayerAnimationFeedback")
local function onPartTouch(otherPart)
if humanoid and canTouch == false then
canTouch = true
wait()
PlayerAnimationFeedback:PlayAnimation()
canTouch = false
end
end
PlayerAnimationFeedback:LoadAnimation(humanoid)
local TouchPartFolder = workspace:WaitForChild("TouchPartFolder")
local touchParts = TouchPartFolder:GetChildren()
for objectIndex = 1, #touchParts do
local touchPart = touchParts[objectIndex]
touchPart.Touched:Connect(onPartTouch())
end
2st script located in ReplicatedStorage
local PlayerAnimationFeedback = {}
local FeedbackAnimationTrack
local ANIMATION_FADE = 0.3
local ANIMATION_ID = "rbxassetid://"
function PlayerAnimationFeedback:LoadAnimation(humanoid)
local FeedbackAnimation = Instance.new("Animation")
FeedbackAnimation.AnimationId = 9351168813
FeedbackAnimationTrack = humanoid:LoadAnimation(FeedbackAnimation)
FeedbackAnimationTrack.Priority = Enum.AnimationPriority.Action
FeedbackAnimation.Looped = true
end
function PlayerAnimationFeedback:PlayAnimation()
FeedbackAnimationTrack:Play(ANIMATION_FADE)
wait(FeedbackAnimationTrack.Length)
end
return PlayerAnimationFeedback
Does someone know how to fix that