Cloned script doesn't execute

Hey developers,
So currently im trying to make a system where each player has their own In-Game 24hr clock. To do this, i do a PlayerAdded function and add a value into the player that has the value of the certain time. Futhermore, i would like to clone a server script into the value that manages the time (adds minutes and formats the time to AM + PM). However, when the script is cloned, it does not execute as stated from the title. Please may i get some help on this, the script that gets cloned needs to be a server script as using a local script can easily be modified by the local player. Thanks.

are you setting Script.Disabled to false?

Yes, here is the script associated with cloning the script.

game.Players.PlayerAdded:Connect(function(player)
	local tmscript = game.ReplicatedStorage:WaitForChild("Scripts"):WaitForChild("TimeManager")
	
	local timeval = Instance.new("StringValue")
	timeval.Name = "RestaurantTime"
	timeval.Value = "08:00"
	timeval:SetAttribute("Minutes", 480)
	local tscript = tmscript:Clone()
	timeval.Parent = player; tscript.Parent = timeval
	tscript.Enabled = true
end)

can i see the time manager script

Currently, i haven’t added anything inside the timemanager script. I have tried running a print however nothing appears in the output. I also made sure that the script that gets cloned does get enabled.

actually it might be because server scripts dont execute when they are a descendant of a player but im not 100% sure

1 Like

yeah it says server scripts only run when they are in ServerScriptService or workspace

so youll have to try osmething else

1 Like

Okay, thanks for letting me know.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.