#Animation refuses to work

1 messages · Page 1 of 1 (latest)

craggy tinsel
#

I created a custom model for my game, it is fully rigged and the animation works in the animation editor. I use this script for Animate.
"local char = script.Parent
local humanoid = char:WaitForChild("Humanoid")
local walkAnim = script:WaitForChild("Walk")
local walkAnimTrack = humanoid.Animator:LoadAnimation(WalkAnim)

humanoid.Running:Connect(function(speed)
if speed > 0 then
if not walkAnimTrack.IsPlaying then
walkAnimTrack:Play()
end
else
if walkAnimTrack.IsPlaying then
walkAnimTrack:Stop()
end
end
end)"

No matter what I do I cant figure out how to get it working.

hushed vapor
lofty adder
#

@craggy tinsel

lofty adder
craggy tinsel
#

im back

#

THANK YOU

#

TYSM IT WORKED

craggy tinsel
tiny moonBOT
#

studio** You are now Level 1! **studio

craggy tinsel
#

Today we're starting a new series on how to create a Simulator on Roblox in 2022! We'll go through all the systems of a modern simulator and recreate each individual one!

Subscribe for more Roblox Scripting Tutorials!

Join my Patreon to support me and gain access to the Scripts in this video! https://www.patreon.com/MonzterDEV

Get the Profile...

▶ Play video
#

I fixed it, but found another issue.

hushed vapor
craggy tinsel
#

same error here

vagrant plume
#

Enable API services

#

thats profile service

#

In your game settings

craggy tinsel
#

they are enabled

vagrant plume
#

The error says otherwise

#

Double check

#

maybe restart studio even

craggy tinsel
#

my settings say otherwise

#

ill restart rq

vagrant plume
#

Alright

craggy tinsel
#

oh that

#

i said i fixed it earlier

craggy tinsel
vagrant plume
#

Oh lmao mb

craggy tinsel
#

its fine

vagrant plume
#

Line 42 is the error so

vagrant plume
craggy tinsel
#

should i send the whole script

vagrant plume
#

Sure

craggy tinsel
#

local Players = game:GetService("Players")
local ServerScriptService = game:GetService("ServerScriptService")

local Template = require(ServerScriptService.PlayerData.Template)
local Manager = require(ServerScriptService.PlayerData.Template)
local ProfileService = require(ServerScriptService.Libs.ProfileService)

local ProfileStore = ProfileService.GetProfileStore("Production", Template)

local KICK_MESSAGE = "We are having an issue with sorting data. Please try again soon. If it isnt fixed after a while, feel free to DM me."

local function CreateLeaderstats(player: Player)
local profile = Manager.Profiles[player]
if not profile then return end

local leaderstats = Instance.new("Folder", player)
leaderstats.Name = "leaderstats"

local honey = Instance.new("NumberValue", leaderstats)
honey.Name = "Honey"
honey.Value = profile.Data.Clicks

local coins = Instance.new("NumberValue", leaderstats)
coins.Name = "Coins"
coins.Value = profile.Data.Coins

end

local function LoadProfile(player: Player)
local profile = ProfileStore:LoadProfileAsync("Player_"..player.UserId)
if not profile then
player:Kick(KICK_MESSAGE)
return
end

profile:AddUserId(player.UserId)
profile:Reconcile()
profile:ListenToRelease(function()
    Manager.Profiles[player] = nil
    player:Kick(KICK_MESSAGE)
end)
if player:IsDescendantOf(Players) == true then
    Manager.Profiles[player] = profile
    CreateLeaderstats()
else
    profile:Release()
end

end

for _, player in Players:GetPlayers() do
task.spawn(LoadProfile, player)
end

Players.PlayerAdded:Connect(LoadProfile)
Players.PlayerRemoving:Connect(function(player)
local profile = Manager.Profiles[player]
if profile then
profile:Release()
end
end)

vagrant plume
#

can you add that to your message so i can read it easier

craggy tinsel
#

how

vagrant plume
#

actually i can do it its ok

#
local Players = game:GetService("Players")
local ServerScriptService = game:GetService("ServerScriptService")

local Template = require(ServerScriptService.PlayerData.Template)
local Manager = require(ServerScriptService.PlayerData.Template)
local ProfileService = require(ServerScriptService.Libs.ProfileService)

local ProfileStore = ProfileService.GetProfileStore("Production", Template)

local KICKMESSAGE = "We are having an issue with sorting data. Please try again soon. If it isnt fixed after a while, feel free to DM me."

local function CreateLeaderstats(player: Player)
    local profile = Manager.Profiles[player]
    if not profile then return end

    local leaderstats = Instance.new("Folder", player)
    leaderstats.Name = "leaderstats"

    local honey = Instance.new("NumberValue", leaderstats)
    honey.Name = "Honey"
    honey.Value = profile.Data.Clicks

    local coins = Instance.new("NumberValue", leaderstats)
    coins.Name = "Coins"
    coins.Value = profile.Data.Coins
end

local function LoadProfile(player: Player)
    local profile = ProfileStore:LoadProfileAsync("Player"..player.UserId)
    if not profile then
        player:Kick(KICK_MESSAGE)
        return
    end

    profile:AddUserId(player.UserId)
    profile:Reconcile()
    profile:ListenToRelease(function()
        Manager.Profiles[player] = nil
        player:Kick(KICKMESSAGE)
    end)
    if player:IsDescendantOf(Players) == true then
        Manager.Profiles[player] = profile
        CreateLeaderstats()
    else
        profile:Release()
    end
end

for , player in Players:GetPlayers() do
    task.spawn(LoadProfile, player)
end

Players.PlayerAdded:Connect(LoadProfile)
Players.PlayerRemoving:Connect(function(player)
    local profile = Manager.Profiles[player]
    if profile then
        profile:Release()
    end
end)
#

can you print profile the line above it and see what it says

#

just open the output and it should tell you what profile is

#

when you add print(profile)

craggy tinsel
#

is this what you mean?

vagrant plume
#

above that line put

print(profile)
vagrant plume
craggy tinsel
#

it didnt do anything

vagrant plume
#

it didnt print anything?

craggy tinsel
#

no

vagrant plume
#

how did u add it show me

craggy tinsel
#

wait i put it in wrong

tiny moonBOT
#

studio** You are now Level 2! **studio

craggy tinsel
#
  16:52:44.238   ▼  {
                    ["Data"] =  ▶ {...},
                    ["GlobalUpdates"] =  ▶ {...},
                    ["KeyInfo"] = Instance,
                    ["KeyInfoUpdated"] =  ▶ {...},
                    ["MetaData"] =  ▶ {...},
                    ["MetaTagsUpdated"] =  ▶ {...},
                    ["RobloxMetaData"] = {},
                    ["UserIds"] =  ▶ {...},
                    ["_hop_ready"] = false,
                    ["_hop_ready_listeners"] =  ▶ {...},
                    ["_is_user_mock"] = false,
                    ["_load_timestamp"] = 392.1309059999985,
                    ["_profile_key"] = "Player_2867919320",
                    ["_profile_store"] =  ▶ {...},
                    ["_release_listeners"] =  ▶ {...}
                 }  -  Server - Data:43
  16:52:44.242  ServerScriptService.PlayerData.Data:44: attempt to index nil with Instance  -  Server - Data:44
  16:52:44.242  Stack Begin  -  Studio
  16:52:44.242  Script 'ServerScriptService.PlayerData.Data', Line 44 - function LoadProfile  -  Studio - Data:44
  16:52:44.242  Stack End  -  Studio
vagrant plume
#

ok now print player i guess

craggy tinsel
#
  16:54:46.544   ▼  {
                    ["Data"] =  ▶ {...},
                    ["GlobalUpdates"] =  ▶ {...},
                    ["KeyInfo"] = Instance,
                    ["KeyInfoUpdated"] =  ▶ {...},
                    ["MetaData"] =  ▶ {...},
                    ["MetaTagsUpdated"] =  ▶ {...},
                    ["RobloxMetaData"] = {},
                    ["UserIds"] =  ▶ {...},
                    ["_hop_ready"] = false,
                    ["_hop_ready_listeners"] =  ▶ {...},
                    ["_is_user_mock"] = false,
                    ["_load_timestamp"] = 514.4369752999992,
                    ["_profile_key"] = "Player_2867919320",
                    ["_profile_store"] =  ▶ {...},
                    ["_release_listeners"] =  ▶ {...}
                 }  -  Server - Data:43
  16:54:46.549  ServerScriptService.PlayerData.Data:44: attempt to index nil with Instance  -  Server - Data:44
  16:54:46.549  Stack Begin  -  Studio
  16:54:46.550  Script 'ServerScriptService.PlayerData.Data', Line 44 - function LoadProfile  -  Studio - Data:44
  16:54:46.550  Stack End  -  Studio``` same thing
vagrant plume
#

you printed player and it outputted that?

#

not possible

craggy tinsel
#

wait

#

i did it wrong again

#

sorry

#
  16:56:33.055  MyNameIsAFLEL  -  Server - Data:43
  16:56:33.057  ServerScriptService.PlayerData.Data:44: attempt to index nil with Instance  -  Server - Data:44
  16:56:33.057  Stack Begin  -  Studio
  16:56:33.057  Script 'ServerScriptService.PlayerData.Data', Line 44 - function LoadProfile  -  Studio - Data:44
  16:56:33.057  Stack End  -  Studio```
vagrant plume
#

ok so player exists

#

profile exists

#

the issue must be there is no Profiles table in the Manager

#

is this the manager script?

craggy tinsel
#

it is the data script

vagrant plume
#

the Manager is in ServerScriptService -> PlayerData -> Template

craggy tinsel
#

Manager.Profiles = {}

return module
```this is manager
vagrant plume
#

so it has profiles

craggy tinsel
#

wait i see it

#

i did this on templates too

#

nope

#

that didnt do it

vagrant plume
#

why are u requiring the same module twice

craggy tinsel
#

?

vagrant plume
#

local Template = require(ServerScriptService.PlayerData.Template)
local Manager = require(ServerScriptService.PlayerData.Template)

#

top of the script

craggy tinsel
#

shoot

#

that i think was it

#

the tutorial copy and pasted it and i must've forgot to change that

#

no error but it isnt showing a leaderboard

vagrant plume
#

Fixed?

craggy tinsel
vagrant plume
#

check your player contents in explorer

craggy tinsel
vagrant plume
#

no i mean in the players service

#

That one

#

your player should be in there

#

(only if your testing the game)

#

open the arrow next to your name then screenshot the contents

craggy tinsel
vagrant plume
#

i actually dont think your calling createLeaderstats and thats why

#

wait u are nvm

#

you need to give it the player parameter though

#

on the line that says createLeaderstats() add the player as a parameter

#

like this:

createLeaderstats(player)
craggy tinsel
#

it works! thank you

vagrant plume
#

Nice

craggy tinsel
#

im new to this stuff so im not very good at it

vagrant plume
#

All good you will learn with time

#

good luck with your game

craggy tinsel
#

ty

craggy tinsel