Currently, I am working on a 2.5D game with the idea of the Gang Beasts were you fight each other in an enclosed arena (without the traps), but instead of using your hands as weapons, you use a bow with the same sort of functionality as a bow from Terraria.
But, the problem is, I can’t seem to get any custom animation to work in my game (specifically my idle animation as its the only one I have completed). Here is one of my previous scripts that didn’t work:
local function loadAnims(character)
local humanoid = character:WaitForChild("Humanoid")
local animator = humanoid.WaitForChild("Animator")
for _, track in pairs(animator:GetPlayingAnimationTracks()) do
track:Stop(0)
end
local animScript = character:WaitForChild("Animate")
animScript.idle.IdleAnim.AnimationId = "rbxassetid://15137946836"
end
local function onPlayerAdded(Player)
Player.CharacterAppearanceLoaded:Connect(loadAnims())
end
game.Players.PlayerAdded:Connect(onPlayerAdded)
I was just thinking about it; could the camera script making the game only viewable from one point be tinkering with the animation? Or the script that locks the player only allowing you to move left and right? If so, here are those 2 scripts:
Locking Script:
local playerChr = script.Parent
local rootPart = playerChr.HumanoidRootPart
local plane = game.Workspace.Plane
local attachment1 = Instance.new("Attachment")
attachment1.Parent = rootPart
local planeConst = Instance.new("PlaneConstraint")
planeConst.Parent = rootPart
planeConst.Attachment0 = plane.Attachment0
planeConst.Attachment1 = attachment1
Camera Script:
local camera = game.Workspace.CurrentCamera
local player = game.Players.LocalPlayer
camera.CameraType = Enum.CameraType.Scriptable
local targetDistance = 30
local cameraDistance = -22
local cameraDirection = Vector3.new(0,0,-1.80)
local currentTarget = cameraDirection*targetDistance
local currentPosition = cameraDirection*cameraDistance
game:GetService("RunService").RenderStepped:connect(function()
local character = player.Character
if character and character:FindFirstChild("Humanoid") and character:FindFirstChild("HumanoidRootPart") then
local torso = character.HumanoidRootPart
camera.Focus = torso.CFrame
if torso:FindFirstChild("FastStart") == nil then
camera.CoordinateFrame = CFrame.new(Vector3.new(torso.Position.X, torso.Position.Y + 3, torso.Position.Z - 20) + currentPosition,
Vector3.new(torso.Position.X, torso.Position.Y, torso.Position.Z - 20) + currentTarget)
else
camera.CoordinateFrame = CFrame.new(Vector3.new(torso.Position.X, torso.Position.Y - -20, torso.Position.Z - 20) + currentPosition,
Vector3.new(torso.Position.X, torso.Position.Y - -20, torso.Position.Z - 20) + currentTarget)
end
end
end)