So I’ve been trying to take the value from a number and string that are located inside of a clone. They aren’t updating to the one in replicated storage.
What am I doing wrong?
local games = game.ServerStorage.minigames:GetChildren()
local minitime = game.ReplicatedStorage.minitime.Value
local mininame = game.ReplicatedStorage.mininame.Value
startre = game.ReplicatedStorage.Start
stopre = game.ReplicatedStorage.Stop
local function start()
local mgame = games[math.random(#games)]
local gameclone = mgame:Clone()
gameclone.Parent = workspace
print(mgame)
minitime = gameclone.Time.Value --This is the time thing
mininame = gameclone.Name --This is the Name thing
task.wait(.5)
for _, plr in pairs(game.Players:GetChildren()) do
plr.Character.HumanoidRootPart.CFrame = workspace["tp part"].CFrame
end
local function stop()
gameclone:Destroy()
for _, plr in pairs(game.Players:GetChildren()) do
plr:LoadCharacter()
end
end
stopre.OnServerEvent:Connect(stop)
end
startre.OnServerEvent:Connect(start)
you have referred to Value of the objects which returns an string or int and not an object.
Instead refer to only the object and use .Value = over here
your script is similar to
local minitime = 5
local mininame = "Hey"
local function start()
----
mintime = 15
mininame = "Hey"
----
end
Start()
try the below script, it should work fine
Script
local games = game.ServerStorage.minigames:GetChildren()
local minitime = game.ReplicatedStorage.minitime
local mininame = game.ReplicatedStorage.mininame
startre = game.ReplicatedStorage.Start
stopre = game.ReplicatedStorage.Stop
local function start()
local mgame = games[math.random(#games)]
local gameclone = mgame:Clone()
gameclone.Parent = workspace
print(mgame)
minitime.Value = gameclone.Time.Value --This is the time thing
mininame.Value = gameclone.Name --This is the Name thing
task.wait(.5)
for _, plr in pairs(game.Players:GetChildren()) do
plr.Character.HumanoidRootPart.CFrame = workspace["tp part"].CFrame
end
local function stop()
gameclone:Destroy()
for _, plr in pairs(game.Players:GetChildren()) do
plr:LoadCharacter()
end
end
stopre.OnServerEvent:Connect(stop)
end
startre.OnServerEvent:Connect(start)
try debugging using a print statement after updating the values
ex, try
minitime.Value = gameclone.Time.Value --This is the time thing
mininame.Value = gameclone.Name --This is the Name thing
print(minitime.Value, mininameValue, gameclone.Time.Value , gameclone.Name)