I’m trying to fire a remote event to the client to run animations
My issue is that the remote event isn’t being fired.
Both pieces of code are Module Loaded, with both pieces of code existing in module scripts
Server Side:
local InteractionService = {}
function InteractionService:Init()
local RunService = game:GetService("RunService")
local Configurations = game.ReplicatedStorage.Configurations.Interaction
local Weld = require(game.ReplicatedStorage.Dependencies.Server.Weld)
local rev_InitAnimation = game.ReplicatedStorage.Remotes.RemoteEvent.InitAnimation
local rev_InitInteraction = game.ReplicatedStorage.Remotes.RemoteEvent.InitInteraction
local RANGE_MAX = Configurations.RANGE_MAX.Value
local RANGE_CLOSE = Configurations.RANGE_CLOSE.Value
local TAG_GRABBED = "Interaction_Grabbed"
local TAG_OBJECT = "Interaction_Object"
rev_InitInteraction.OnServerEvent:Connect(function(player:Player, target:Part)
local magnitude = (player.Character:GetPivot().Position - target.Position).Magnitude
if target:HasTag(TAG_GRABBED) or not target:HasTag(TAG_OBJECT) or magnitude > RANGE_MAX or target == nil then
return
end
local playerHumanoid = player.Character.Humanoid
target:AddTag(TAG_GRABBED)
target.Anchored = true
local targetPosition = player.Character:GetPivot().Position:Lerp(target.Position, (magnitude-RANGE_CLOSE)/magnitude)
while RunService.Heartbeat:Wait() do
playerHumanoid:MoveTo(targetPosition)
print(player.Character:GetPivot().Position.X - targetPosition.X, player.Character:GetPivot().Position.Z - targetPosition.Z)
local xCheck = math.abs(player.Character:GetPivot().Position.X - targetPosition.X) < 1
local zCheck = math.abs(player.Character:GetPivot().Position.Z - targetPosition.Z) < 1
if xCheck and zCheck then
break
end
end
local rightArm:Part = player.Character["Right Arm"]
target.Anchored = false
Weld:Create(target, rightArm, CFrame.Angles(math.rad(90),0,0) * target.CFrame, target.CFrame * CFrame.new(0,-1.5,0))
target.CanCollide = false
rev_InitAnimation:FireAllClients()
print("reached")
end)
end
return InteractionService
Client Side
local AnimationHandler = {}
function AnimationHandler:Init()
print("wellness check")
local player = game.Players.LocalPlayer
local animator:Animator = player.Character.Humanoid.Animator
local rev_InitAnimation = game.ReplicatedStorage.Remotes.RemoteEvent.InitAnimation
rev_InitAnimation.OnClientEvent:Connect(function(rblxID)
print("ran")
local animation = Instance.new("Animation")
animation.AnimationId = rblxID
local loadedAnimation = animator:LoadAnimation(animation)
loadedAnimation:Play()
end)
end
return AnimationHandler
Structure: