Hey Guys, here’s my issue.
When a player interacts with a proximity prompt, it should play the animation ON the person interacting with it. However, make sure everyone else on the server can see the animation happening to the person.
Now, it works when I try it on a local server with 2 players in Roblox Studio. Though when in team create and in the actual published game, it doesn’t seem to want to work at all. No animation is shown to anyone. How could this be if it worked in a 2 Player Local test Server?
Here is my code for a LocalScript under the Proximity Prompt which is under the Mesh Part.
local LiftEvent = game.ReplicatedStorage:WaitForChild("LiftEvent")
local prompt = script.Parent
local function onPromptTriggered()
LiftEvent:FireServer()
end
prompt.Triggered:Connect(onPromptTriggered)
LiftEvent.OnClientEvent:Connect(function()
local character = game.Players.LocalPlayer.Character
if character then
local humanoid = character:FindFirstChildOfClass("Humanoid")
if humanoid then
local animation = Instance.new("Animation")
animation.AnimationId = "rbxassetid://5518924930"
local track = humanoid:LoadAnimation(animation)
track:Play()
end
end
end)
Here is my code in a regular script in ServerScriptService
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local LiftEvent = Instance.new("RemoteEvent")
LiftEvent.Name = "LiftEvent"
LiftEvent.Parent = ReplicatedStorage
function onLiftEvent(player)
local character = player.Character
if character then
local humanoid = character:FindFirstChildOfClass("Humanoid")
if humanoid then
local animation = Instance.new("Animation")
animation.AnimationId = "rbxassetid://5518924930"
local track = humanoid:LoadAnimation(animation)
track:Play()
end
end
end
LiftEvent.OnServerEvent:Connect(onLiftEvent)
And finally here is my code in a LocalScript in StarterPlayerScripts
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local LiftEvent = ReplicatedStorage:WaitForChild("LiftEvent")
local ProximityPrompt = game.Workspace.CWC.CupMesh.ProximityPrompt
ProximityPrompt.Triggered:Connect(function()
LiftEvent:FireServer()
end)
This animation is a test Animation just until I get this mechanism working, then I aim to create an animation where the player lifts up a trophy, (which I am still trying to figure out).