If you didn’t notice, client sided in studio works perfectly, just how I want it too. When I switch to server sided, the frogs rotation breaks. In-game, the frogs animations don’t work anymore but they do rotate. I’m so confused, here is the script to the frog moving:
local root = script.Parent.Parent.PrimaryPart
game:GetService("ReplicatedStorage").FrogCam.OnServerEvent:Connect(function(player, target)
if target == script.Parent.Parent then
game.Players[player.Name].Character.Humanoid.WalkSpeed = 0
game.Players[player.Name].Character.Humanoid.JumpPower = 0
script.Parent.Parent.PlayerPosition.WeldToPlayer.Part1 = game.Players[player.Name].Character.HumanoidRootPart
game.Players[player.Name].Character.Humanoid:LoadAnimation(script:WaitForChild("PlayerKneel")):Play()
script.Disabled = true
end
end)
while true do wait(math.random(1,5))
local randomnumber = math.round(math.random(1,3))
if randomnumber == 1 then
root.Orientation = Vector3.new(0,math.random(0,360),0)
end
local humanoid = script.Parent
local f = humanoid:LoadAnimation(script:WaitForChild("Jump"))
f:Play()
wait(.2)
for i = 1, 6 do wait()
root.CFrame = root.CFrame + root.CFrame.lookVector * -1
end
end
Once again, this is 100% a server script, recommended for NPC animations.
First of all, I recommend using task.wait instead of wait
Second of all, math.random does not return float values, so there’s no need to use math.round on the variable randomnumber
Now try this and tell me if it works.
local root = script.Parent.Parent.PrimaryPart
local humanoid = script.Parent
local animationtrack = humanoid:LoadAnimation(script:WaitForChild("Jump"))
root:SetNetworkOwner(nil)
game:GetService("ReplicatedStorage").FrogCam.OnServerEvent:Connect(function(player, target)
if target == script.Parent.Parent then
game.Players[player.Name].Character.Humanoid.WalkSpeed = 0
game.Players[player.Name].Character.Humanoid.JumpPower = 0
script.Parent.Parent.PlayerPosition.WeldToPlayer.Part1 = game.Players[player.Name].Character.HumanoidRootPart
game.Players[player.Name].Character.Humanoid:LoadAnimation(script:WaitForChild("PlayerKneel")):Play()
script.Disabled = true
end
end)
while true do
task.wait(math.random(1,5))
local randomnumber = math.random(1,3)
if randomnumber == 1 then
root.Orientation = Vector3.new(0,math.random(0,360),0)
end
animationtrack:Play()
task.wait(.2)
for i = 1, 6 do wait()
root.CFrame = root.CFrame + root.CFrame.lookVector * -1
end
end
Here’s what I noticed, I originally only anchored the HumanoidRootPart, when I anchored the entire model, the rotations in the studio server were working, but the frogs weren’t moving or having their animations played. In studio client sided, and in-game is acted the exact same. Nothing changed.
Go to the Test tab in the studio and set the server population to 2 Players, and then Start Server via the server icon in the same tab. This will create three window, with one of them being the server-sided view and the other two windows being separate clients.
Doing this will allow you to do multiplayer testing without the need of another person.