I’m trying to clone npcs from replicated storage to workspace. They have their scripts disabled while in replicatedstorage and their clones have them get enabled. When enabled, the scripts do not work. When not cloning and instead taking the npcs out of replicatedstorage and putting them into workspace, they function fine.
Are you enabling the script for the original npc instead of the cloned one? It’s easier to solve your issue if you could show the code where you clone and enable the scripts
local ServerStorage = game:GetService("ServerStorage")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local FightersFolder = ServerStorage.Fighters
local CurrentFighters = ReplicatedStorage.CurrentFighters
--Values
local TimerDefault = 5--45
function timer()
local Time = TimerDefault
while Time > -1 do
if workspace:FindFirstChild('TimerMessage') then
workspace:FindFirstChild('TimerMessage'):Destroy()
end
local TimerMessage = Instance.new('Hint')
TimerMessage.Name = 'TimerMessage'
TimerMessage.Parent = workspace
TimerMessage.Text = 'Intermission: '..Time
task.wait(1)
Time -= 1
end
TheFight()
end
local Arenas = ServerStorage.Arenas:GetChildren()
local Fighters = ServerStorage.Fighters:GetChildren()
local CurrentRound = 1
function Round()
local RoundMessage = Instance.new('Hint')
RoundMessage.Name = 'RoundMessage'
RoundMessage.Parent = workspace
RoundMessage.Text = 'Round '..CurrentRound
task.wait(2)
workspace:FindFirstChild('RoundMessage'):Destroy()
for i, Fighter in ChosenFighters do
Fighter.Parent = workspace.Arena
Fighter.PrimaryPart.Anchored = true
Fighter.PrimaryPart.CFrame = ArenaSpawns[i].CFrame * CFrame.new(0, 10, 0)
end
local Time = 5
while Time > -1 do
if workspace:FindFirstChild('TimerMessage') then
workspace:FindFirstChild('TimerMessage'):Destroy()
end
local TimerMessage = Instance.new('Hint')
TimerMessage.Name = 'TimerMessage'
TimerMessage.Parent = workspace
TimerMessage.Text = Time
task.wait(1)
Time -= 1
end
if workspace:FindFirstChild('TimerMessage') then
workspace:FindFirstChild('TimerMessage'):Destroy()
end
for i, Fighter in ipairs(ChosenFighters) do
Fighter.PrimaryPart.Anchored = false
for x, c in Fighter:GetDescendants() do
if c:IsA('Script') then
c.Enabled = true
end
end
end
local FightMessage = Instance.new('Hint')
FightMessage.Name = 'FightMessage'
FightMessage.Parent = workspace
FightMessage.Text = 'FIGHT!'
task.wait(2)
workspace:FindFirstChild('FightMessage'):Destroy()
end
function TheFight()
if workspace:FindFirstChild('TimerMessage') then
workspace:FindFirstChild('TimerMessage'):Destroy()
end
local Arena = Arenas[math.random(1, #Arenas)]:Clone()
Arena.Parent = workspace.Arena
ArenaSpawns = {}
for i, Spawn in Arena:GetDescendants() do
if Spawn.Name == 'Spawn' then
table.insert(ArenaSpawns, Spawn)
end
end
local ArenaMessage = Instance.new('Hint')
ArenaMessage.Name = 'ArenaMessage'
ArenaMessage.Parent = workspace
ArenaMessage.Text = 'Chosen Arena: '..Arena.Name
task.wait(5)
local Fighter1 = Fighters[math.random(1, #Fighters)]
local Fighter2 = Fighters[math.random(1, #Fighters)]
if Fighter2 == Fighter1 then
repeat Fighter2 = Fighters[math.random(1, #Fighters)] until Fighter2 ~= Fighter1
end
Fighter1 = Fighter1:Clone()
Fighter2 = Fighter2:Clone()
ChosenFighters = {Fighter1, Fighter2}
for i, Fighter in ChosenFighters do
Fighter.Parent = ReplicatedStorage.CurrentFighters
end
workspace:FindFirstChild('ArenaMessage'):Destroy()
local FightersMessage = Instance.new('Hint')
FightersMessage.Name = 'FightersMessage'
FightersMessage.Parent = workspace
FightersMessage.Text = 'Cast your votes!'
task.wait(2)
workspace:FindFirstChild('FightersMessage'):Destroy()
local Time = 13
while Time > -1 do
if workspace:FindFirstChild('TimerMessage') then
workspace:FindFirstChild('TimerMessage'):Destroy()
end
local TimerMessage = Instance.new('Hint')
TimerMessage.Name = 'TimerMessage'
TimerMessage.Parent = workspace
TimerMessage.Text = 'Voting ends in: '..Time
task.wait(1)
Time -= 1
end
if workspace:FindFirstChild('TimerMessage') then
workspace:FindFirstChild('TimerMessage'):Destroy()
end
Round()
end
timer()
It gets enabled on the clone
Jeez dude its not 2013
why are you using 999999 B.C. instances? ![]()
You have to parent script into anywhere where it can run;
Workspace for example.
No script context can run independently in nil.
1 Like
I don’t understand. Where is it putting a script into nil?
You need to parent script somewhere
You are keeping it at nil
where in the script is it doing this?
Maybe try to enable the script after the npc is inside the workspace. You’re enabling it beforehand
I’m already enabling it after theyre in the workspace