You can write your topic however you want, but you need to answer these questions:
- What do you want to achieve? Keep it simple and clear!
What I’m trying to do is get the move in the video below to look like it does on the lefthand side for all clients and the server. The Roblox studio on the lefthand side is the local client and the one on the right is another client. This is a simplified version of what I’m actually trying to do but it includes everything I think is relevant to the problem
- What is the issue? Include screenshots / videos if possible!
https://gyazo.com/1bea490b37e6bd5900a75f273f5484ab
When the player has the tool equipped and presses M1 then the Fire function shown below is executed which plays an animation. This animation has a marker called fire which stops the animation, then invokes the server which waits 2 seconds, then prints something and then returns true which allows the client code to keep running so the animation resumes.
Where I believe the problem lies is when the marker is reached for the local client it somehow executes the following code:
anim:GetMarkerReachedSignal("Fire"):Connect(function()
anim:AdjustSpeed(0)
local arm = RemoteFunction:InvokeServer()
anim:AdjustSpeed(1)
end)
for all the other clients which is what I don’t understand. This is a problem because the animation that plays on other clients is delayed so the results I want can’t be achieved .
I’ll attach the relevant code below:
-- Client
function Fire(name,state,input)
if state == Enum.UserInputState.Begin then
anim:Play()
end
end
anim:GetMarkerReachedSignal("Fire"):Connect(function()
anim:AdjustSpeed(0)
local arm = RemoteFunction:InvokeServer()
anim:AdjustSpeed(1)
end)
script.Parent.Equipped:Connect(function()
CAS:BindActionAtPriority(script.Parent.Name,Fire,false,2,Enum.UserInputType.MouseButton1)
end)
script.Parent.Unequipped:Connect(function()
CAS:UnbindAction(script.Parent.Name)
end)
--Server
RunFunctions.OnServerInvoke = function(player,attackName,func, info)
wait(2)
print("In sever core")
return true
end
-
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I don’t understand how animation replication works too well so I’m struggling to figure out how to make this work at all and I couldn’t find helpful information on this either.
Thanks in advance.