Situation:
I am playing a sleep animation in a localscript when someone sleeps
Currently only the local player can see it bc it is being played in a local script in starterplayerscripts
How do I fix this?
Animations are automatically replicated to server. The animation must be owned by the same user who owns the ganme
It is owned by the group, which is why I’m confused. code below:
-- SERVICES --
local UserInputService = game:GetService("UserInputService")
local ProximityPromptService = game:GetService("ProximityPromptService")
-- CONSTANTS --
local Player = game:GetService("Players").LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild("Humanoid")
local Animator = Humanoid:WaitForChild("Animator")
local HumanoidRootPart = Character:WaitForChild("HumanoidRootPart")
local animation = Instance.new("Animation")
animation.AnimationId = "rbxassetid://10214821046"
local Track = Animator:LoadAnimation(animation)
Track.Priority = Enum.AnimationPriority.Action
Track.Looped = true
-- SLEEP --
local sleep = false
local promptSave
local function onPromptTriggered(prompt, player)
if prompt.Name == "Sleep" then
sleep = true
HumanoidRootPart.Anchored = true
Track:Play()
HumanoidRootPart.CFrame = CFrame.new(Vector3.new(prompt.Parent.Position.X, prompt.Parent.Position.Y+3, prompt.Parent.Position.Z)) * CFrame.Angles(0, prompt.Parent.Orientation.y+270, 0)
prompt.Parent.Parent.SleepPart1.Sleep.Enabled = false
prompt.Parent.Parent.SleepPart2.Sleep.Enabled = false
promptSave = prompt
end
end
UserInputService.JumpRequest:Connect(function()
if sleep == true then
sleep = false
Track:Stop()
HumanoidRootPart.Anchored = false
promptSave.Parent.Parent.SleepPart1.Sleep.Enabled = true
promptSave.Parent.Parent.SleepPart2.Sleep.Enabled = true
end
end)
ProximityPromptService.PromptTriggered:Connect(onPromptTriggered)```
Try to move it to starter pack and c if it works
I see your waiting on the animator which should replicate when used
maybe try parenting the animation to the character before loading it and also try unanchoring the player and see if that has anything to do with it