Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How can I disable the default "Animate" script in a spawned character?

I am trying to disable the default "Animate" script that automatically spawns in characters so that I can make my own custom controls & animations for a custom character. Neither of the two strategies I tried worked. Am I just missing some information about network ownership or replication? I thought this could be done on a local script.

BOTH LOCAL SCRIPTS 1.

player = game.Players.LocalPlayer
player.CharacterAdded:Connect(function(character)
	character:WaitForChild("Animate").Disabled = true
end)

DOES NOT WORK.

player = game.Players.LocalPlayer
oldAnimate = game.workspace:WaitForChild(player.Character.Animate)
oldAnimate.Disabled = true

DOES NOT WORK

With both ways (local scripts), the "Animate" script "Disabled" box is still unchecked when I look in the character model in the workspace when the game is launched.

1 comment

0

If my script works for you, then can you mark it as the correct answer?

3 answers

✓ Accepted answer

For fix this use ServerScripts!

For first, insert a ServerScript(Script) in ServerScriptService and put this script:

game.Players.PlayerAdded:Connect(function(plr) -- On player added get player
	plr.CharacterAdded:Connect(function(char) -- On character of player added get character
		local anims = char:WaitForChild("Animate") -- Wait for script named as "Animate"
		anims.Disabled = true -- Disable the Animate script.
		
		-- Go to stop all anims in Humanoid
		for _,Anim in pairs(char:WaitForChild("Humanoid"):GetPlayingAnimationTracks()) do -- Wait for humanoid and get all anim's in humanoid, after get humanoid and tracks stop all
			Anim:Stop() -- Stop all anims.
		end
	end)
end)

Players.PlayerAdded - Detect if a player added in game (Only ServerScript)

Player.CharacterAdded - Detect character of player added

WaitForChild - Wait for instance

For loop - Loop to get all in a "table", and you can use this for re-name items... and more.

GetChildren - Transform children of location in a "table"

Examples:

-- WaitForChild
workspace:WaitForChild("Item").Parent = game.ServerStorage -- Wait for item and put it on ServerStorage

-- PlayerAdded
game.Players.PlayerAdded:Connect(function(player)
	print("The player " .. player.Name .. " joined to game!")
end)

-- CharacterAdded
game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(char)
		print("The char of player " .. player.Name .. " spawned!")
	end)
end)

-- generic for loop
for index,value in pairs(workspace:GetChildren()) do -- Get all in workspace in a "table"
	print(value.Name) -- Print name of all items in workspace
end

Hope it helped, Errors? tell-me on comments.

Wiki pages

For loop

WaitForChild

GetChildren

PlayerAdded

CharacterAdded


Solved your problems? put [SOLVED] in title or accept a answer.

The local script wouldn't work for the character, so heres my try which isnt in a local.

game.Players.PlayerAdded:Connect(function(plr)
plr:WaitForChild("Character")
plr.Character.CharacterAdded:Connect(function(character)
character.Animate.Disabled = true

3 comments

0

is the character not replicated because it is part of the workspace or is it a special property of Player.Character to not be accessible by local scripts?

0

Well, tbh i think it can be accessed by local scripts, but this one might work better. Tell me if the entire thing works.

0

SMH it's because changes to character scripts on the client-side aren't replicated to the server

If you don't care about not getting the default animations back, then you could have a script that actually replaces them with the ones you want, so you don't have to add a new script to run your animations.

But if you don't want to do that, then you can just have this in character scripts:

wait()
script.Parent.Animate.Disabled = true

1 comment

0

i tried that code in both a local script and a server-script, both inside the character model, and the "Animate" "Disabled" box is still unchecked

This discussion is preserved as it was. New answers, comments, and votes are closed.