Proximity Animation doesn't work

Hi guys, today I set about roblox heist system. The whole thing consists of a proximity switch that activates the animation of the character, only this one doesn’t work (it’s published by me and used in my place). Now I am attaching the screens of where everything is.
image
image
image
image

If you need more photos, please ask

You should first load the Animation into a local script at the start of the game, and then call it from there. This will prevent animation limit exceeded.

LOCLA SCRIPT:

local Animation = WhereverYourAnimationIs
local humanoid = game.Players.LocalPlayer.Character:WaitForChild('Humanoid')

local Animations = {
       humanoid.Animator:LoadAnimation(Animation),
}

function PlayAnimation(Anim)
Animations[Anim]:Play() -- You need to put the 'Anim' parameter as a number for this
-- you could also change the table if you want. 
end

game.ReplicatedStorage.DanceEvent.OnClientEvent:Connect(PlayAnimation) -- it will automatically get the parameter and fire the event.

SERVERSCRIPT / PROXIMITY PROMOT

Make an attribute / IntValue in your ProximityPrompt to check what animation is going to play.

script.Parent.Triggered:Connect(function(player)
local AnimNumber = script.Parent:GetAttribute('AnimNumber') -- Make this 1 cus theres only 1 animation in the table
game.ReplicatedStorage.DanceEvent:FireClinet(player,AnimNumber)
end
1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.