Been trying to do this for a while now, however can't seem to get it to work. Every time I run a test, it just prints out an error and doesn't work. According to the error, the script which is suppossed to replace the default "Animate" on your character cannot find the new one which I named "Custom". If it's unable to find "Custom", then it just won't work, however I got no idea on how to fix this as I'm still just a beginner learning how to do stuff. Any ideas? (After clicking on the error it just highlights all of the "NewAnimScript", therefore I assume it didn't assign "Custom" to it)
local Player = game.Players.LocalPlayer; local Character = Player.Character or Player.CharacterAdded:Wait(); -- Wait for the character to spawn local Humanoid = Character:WaitForChild("Humanoid"); Character:WaitForChild("Animate"):Destroy(); -- Destroy the default animations local Tracks = Humanoid:GetPlayingAnimationTracks(); -- Get all playing animations from our character for i, thistrack in pairs(Tracks) do -- Stop and destroy all animations that are playing thistrack:Stop(); thistrack:Destroy(); end local NewAnimScript = ("Custom") -- Reference and parent the new script NewAnimScript.Parent = Character; NewAnimScript.Disabled = false;
Workspace.WurksBrother99.LocalScript:15: attempt to index string with 'Parent' - The error it prints out
Hello,
It appears you are trying to set the parent of a string instead of creating a new script. To fix this simply change your code from:
local NewAnimScript = ("Custom") -- Reference and parent the new script NewAnimScript.Parent = Character NewAnimScript.Disabled = false
To:
local NewAnimScript = Instance.new("Script") NewAnimScript.Name = "Custom" NewAnimScript.Parent = Character NewAnimScript.Disabled = false
I will note that I am assuming that you are creating a new script instead of making a clone of a premade one. If you are creating a clone of a premade animation script, you would change the code to:
local NewAnimScript = ["replace brackets with path"]:Clone() NewAnimScript.Parent = Character NewAnimScript.Disabled = false
Hope this cleared up some confusion, it appears you made a simple typo.
Cheers,
Chase