Hocam R15 kullanın. R15'te animasyonlar bir tık daha iyi çalışıyor.

Arkadaşlar, şu anda bir RPG oyunu yapıyorum. İlk seviyenin canavarlarını oluşturdum ama yürüme animasyonları olmadığı için aşırı berbat gözüküyor. Elimde animasyonlar var ama hangi kodları kullanıcağımı bilmiyorum. Çalışmayan kod: Kod:Panoya kopyala local Figure = script. Parent local Torso = Figure:WaitForChild local RightShoulder = Torso:WaitForChild local LeftShoulder = Torso:WaitForChild local RightHip = Torso:WaitForChild local LeftHip = Torso:WaitForChild local Neck = Torso:WaitForChild local Humanoid = Figure:WaitForChild local pose = "Standing" local currentAnim = "" local currentAnimInstance = nil local currentAnimTrack = nil local currentAnimKeyframeHandler = nil local currentAnimSpeed = 1.0 local animTable = local animNames = { idle = { , }, walk = { }, run = { }, jump = { }, fall = { }, climb = { }, sit = { }, toolnone = { }, toolslash = { -- }, toollunge = { }, wave = { }, point = { }, dance1 = { , , }, dance2 = { , , }, dance3 = { , , }, laugh = { }, cheer = { }, } local dances = -- Existance in this list signifies that it is an emote, the value indicates if it is a looping emote local emoteNames = function configureAnimationSet if then for _, connection in pairs do connection:disconnect end end animTable = animTable . count = 0 animTable . totalWeight = 0 animTable . connections = -- check for config values local config = script:FindFirstChild if then -- print table. insert(animTable . connections, config. ChildAdded:connect(function configureAnimationSet end)) table. insert(animTable . connections, config. ChildRemoved:connect(function configureAnimationSet end)) local idx = 1 for _, childPart in pairs(config:GetChildren do if (childPart:IsA then table. insert(animTable . connections, childPart. Changed:connect(function configureAnimationSet end)) animTable = animTable . anim = childPart local weightObject = childPart:FindFirstChild if then animTable . weight = 1 else animTable . weight = weightObject. Value end animTable . count = animTable . count + 1 animTable . totalWeight = animTable . totalWeight + animTable . weight -- print(name.. " " .. animTable . anim. AnimationId.. " ") idx = idx + 1 end end end -- fallback to defaults if (animTable . count <= 0) then for idx, anim in pairs do animTable = animTable . anim = Instance. new animTable . anim. Name = name animTable . anim. AnimationId = anim. id animTable . weight = anim. weight animTable . count = animTable . count + 1 animTable . totalWeight = animTable . totalWeight + anim. weight -- print(name.. " " .. anim. id.. " ") end end end -- Setup animation objects function scriptChildModified local fileList = animNames if then configureAnimationSet end end script. ChildAdded:connect script. ChildRemoved:connect for name, fileList in pairs do configureAnimationSet end -- ANIMATION -- declarations local toolAnim = "None" local toolAnimTime = 0 local jumpAnimTime = 0 local jumpAnimDuration = 0.3 local toolTransitionTime = 0.1 local fallTransitionTime = 0.3 local jumpMaxLimbVelocity = 0.75 -- functions function stopAllAnimations local oldAnim = currentAnim -- return to idle if finishing an emote if then oldAnim = "idle" end currentAnim = "" currentAnimInstance = nil if then currentAnimKeyframeHandler:disconnect end if then currentAnimTrack:Stop currentAnimTrack:Destroy currentAnimTrack = nil end return oldAnim end function setAnimationSpeed if speed = currentAnimSpeed then currentAnimSpeed = speed currentAnimTrack:AdjustSpeed end end function keyFrameReachedFunc if then local repeatAnim = currentAnim -- return to idle if finishing an emote if then repeatAnim = "idle" end local animSpeed = currentAnimSpeed playAnimation(repeatAnim, 0.0, Humanoid) setAnimationSpeed end end -- Preload animations function playAnimation local roll = math. random(1, animTable . totalWeight) local origRoll = roll local idx = 1 while do roll = roll - animTable . weight idx = idx + 1 end -- print local anim = animTable . anim -- switch animation if then if then currentAnimTrack:Stop currentAnimTrack:Destroy end currentAnimSpeed = 1.0 -- load it to the humanoid; get AnimationTrack currentAnimTrack = humanoid:LoadAnimation currentAnimTrack. Priority = Enum. AnimationPriority. Core -- play the animation currentAnimTrack:Play currentAnim = animName currentAnimInstance = anim -- set up keyframe name triggers if then currentAnimKeyframeHandler:disconnect end currentAnimKeyframeHandler = currentAnimTrack. KeyframeReached:connect end end local toolAnimName = "" local toolAnimTrack = nil local toolAnimInstance = nil local currentToolAnimKeyframeHandler = nil function toolKeyFrameReachedFunc if then -- print playToolAnimation(toolAnimName, 0.0, Humanoid) end end function playToolAnimation local roll = math. random(1, animTable . totalWeight) local origRoll = roll local idx = 1 while do roll = roll - animTable . weight idx = idx + 1 end -- print local anim = animTable . anim if then if then toolAnimTrack:Stop toolAnimTrack:Destroy transitionTime = 0 end -- load it to the humanoid; get AnimationTrack toolAnimTrack = humanoid:LoadAnimation if priority then toolAnimTrack. Priority = priority end -- play the animation toolAnimTrack:Play toolAnimName = animName toolAnimInstance = anim currentToolAnimKeyframeHandler = toolAnimTrack. KeyframeReached:connect end end function stopToolAnimations local oldAnim = toolAnimName if then currentToolAnimKeyframeHandler:disconnect end toolAnimName = "" toolAnimInstance = nil if then toolAnimTrack:Stop toolAnimTrack:Destroy toolAnimTrack = nil end return oldAnim end function onRunning if speed > 0.01 then playAnimation("walk", 0.1, Humanoid) if currentAnimInstance and currentAnimInstance. AnimationId "http://www.roblox.com/asset/?id=180426354" then setAnimationSpeed(speed / 14.5) end pose = "Running" else if emoteNames nil then playAnimation("idle", 0.1, Humanoid) pose = "Standing" end end end function onDied pose = "Dead" end function onJumping playAnimation("jump", 0.1, Humanoid) jumpAnimTime = jumpAnimDuration pose = "Jumping" end function onClimbing playAnimation("climb", 0.1, Humanoid) setAnimationSpeed(speed / 12.0) pose = "Climbing" end function onGettingUp pose = "GettingUp" end function onFreeFall if (jumpAnimTime <= 0) then playAnimation end pose = "FreeFall" end function onFallingDown pose = "FallingDown" end function onSeated pose = "Seated" end function onPlatformStanding pose = "PlatformStanding" end function onSwimming if speed > 0 then pose = "Running" else pose = "Standing" end end function getTool for _, kid in ipairs(Figure:GetChildren do if kid. className "Tool" then return kid end end return nil end function getToolAnim for _, c in ipairs(tool:GetChildren do if c. Name "toolanim" and c. className "StringValue" then return c end end return nil end function animateTool if then playToolAnimation return end if then playToolAnimation("toolslash", 0, Humanoid, Enum. AnimationPriority. Action) return end if then playToolAnimation("toollunge", 0, Humanoid, Enum. AnimationPriority. Action) return end end function moveSit RightShoulder. MaxVelocity = 0.15 LeftShoulder. MaxVelocity = 0.15 RightShoulder:SetDesiredAngle(3.14 /2) LeftShoulder:SetDesiredAngle(-3.14 /2) RightHip:SetDesiredAngle(3.14 /2) LeftHip:SetDesiredAngle(-3.14 /2) end local lastTick = 0 function move local amplitude = 1 local frequency = 1 local deltaTime = time - lastTick lastTick = time local climbFudge = 0 local setAngles = false if (jumpAnimTime > 0) then jumpAnimTime = jumpAnimTime - deltaTime end if (pose "FreeFall" and jumpAnimTime <= 0) then playAnimation elseif then playAnimation("sit", 0.5, Humanoid) return elseif then playAnimation("walk", 0.1, Humanoid) elseif then -- print stopAllAnimations amplitude = 0.1 frequency = 1 setAngles = true end if then local desiredAngle = amplitude math. sin RightShoulder:SetDesiredAngle LeftShoulder:SetDesiredAngle RightHip:SetDesiredAngle LeftHip:SetDesiredAngle end -- Tool Animation handling local tool = getTool if tool and tool:FindFirstChild then local animStringValueObject = getToolAnim if animStringValueObject then toolAnim = animStringValueObject. Value -- message recieved, delete StringValue animStringValueObject. Parent = nil toolAnimTime = time + .3 end if time > toolAnimTime then toolAnimTime = 0 toolAnim = "None" end animateTool else stopToolAnimations toolAnim = "None" toolAnimInstance = nil toolAnimTime = 0 end end -- connect events Humanoid. Died:connect Humanoid. Running:connect Humanoid. Jumping:connect Humanoid. Climbing:connect Humanoid. GettingUp:connect Humanoid. FreeFalling:connect Humanoid. FallingDown:connect Humanoid. Seated:connect Humanoid. PlatformStanding:connect Humanoid. Swimming:connect -- main program -- initialize to idle playAnimation("idle", 0.1, Humanoid) pose = "Standing" while Figure. Parent = nil do local _, time = wait(0.1) move end Son düzenleyen: Moderatör: 19 Temmuz 2021

Hocam ama NPC'leri R6'ya göre kodladım. Oyunu R15'e geçirirsem bütün emeklerim gidicek. Ayrıca R6 daha kolay.