so i made this script which clones an animate script and pastes it into the player, the animations play but dont replicate to other clients, what can i do to fix?
plr.CharacterAdded:Connect(function()
local newAnimate = script.Animate:Clone()
newAnimate.Parent = plr.Character
end)
Birdie, i have ascript which switches the player’s character, i forgot to mention that, here’s that script:
local function respawnPlayer(plr, modelName)
local model = game.ReplicatedStorage.Characters:FindFirstChild(modelName)
local oldModel = plr.Character
local newModel = model:Clone()
newModel.Name = plr.Name
local oldCFrame = oldModel:GetPrimaryPartCFrame()
oldModel:Destroy()
plr.Character = newModel
newModel.Parent = workspace -- [1] this follows current character loading behavior
newModel:SetPrimaryPartCFrame(oldCFrame)
local newAnimate = script.Animate:Clone()
newAnimate.Parent = model
end
game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(chr)
if not chr:GetAttribute("Character") then
respawnPlayer(plr,"RangeBoio")
game.ReplicatedStorage.Events.Ragdoll:FireClient(plr,true)
end
end)
end)
-- Put this script inside ServerScriptService since it handle, well the Server
local function respawnPlayer(plr, modelName)
local model = game.ReplicatedStorage.Characters:FindFirstChild(modelName)
local newModel = model:Clone()
newModel.Name = plr.Name
local oldModel = plr.Character
local oldCFrame = oldModel:GetPrimaryPartCFrame()
oldModel:Destroy()
plr.Character = newModel
plr.Character.Parent = workspace -- Since the player's character has been changed, you don't need to type "newModel.Parent"
plr.Character:SetPrimaryPartCFrame(oldCFrame)
local newAnimate = script.Animate:Clone()
newAnimate.Parent = plr.Character
end
game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(chr)
if not chr:GetAttribute("Character") then
respawnPlayer(plr,"RangeBoio")
game.ReplicatedStorage.Events.Ragdoll:FireClient(plr,true)
end
end)
end)
Hmm, did the script have “Animate” in it? And oh well, here is the newly done script :
local function respawnPlayer(plr, modelName)
local model = game.ReplicatedStorage.Characters:FindFirstChild(modelName)
local newModel = model:Clone()
newModel.Name = plr.Name
local oldModel = plr.Character
local oldCFrame = oldModel:GetPrimaryPartCFrame()
oldModel:Destroy()
plr.Character = newModel
plr.Character.Parent = workspace -- Since the character has changed, you don't need to type "newModel.Parent"
plr.Character:SetPrimaryPartCFrame(oldCFrame)
if plr.Character:FindFirstChild("Animate") == nil then
local newAnimate = script.Animate:Clone()
newAnimate.Parent = plr.Character
end
end
game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(chr)
if not chr:GetAttribute("Character") then
respawnPlayer(plr,"RangeBoio")
game.ReplicatedStorage.Events.Ragdoll:FireClient(plr,true)
end
end)
end)
Edit : the reason why the other one doesn’t work, it’s because it has 8 “Animate” inside of the player’s character. All of the animations are overriding the same animations
Yes it is, it is enabled and everything should be working, but it still doesnt replicate.
i tried setting the original animate’s parent to the new character but still, nothing.