Okay, so I have a script which clones a IntValue and a Script parented to the IntValue, and the Script is supposed to change the value of the IntValue when it rceives a RemoteEvent.
The problem here is that, the Script just refuses to run after being cloned and enabled. Even the print statement at the top of the Script doesn’t even run after being enabled?
I’ve been looking around the DevForum but there was nothing that really addressed my issue. I’ll link the place file where I’m experiencing the issue here:
BuggyPlace.rbxl (61.2 KB)
Server Scripts:
Server Script for cloning
local Players = game:GetService("Players")
Players.PlayerAdded:Connect(function(plr)
local quizFolder = Instance.new("Folder")
quizFolder.Name = "quizFolderStats"
quizFolder.Parent = plr
local quizTimer = Instance.new("IntValue")
quizTimer.Name = "quizTimerValue"
quizTimer.Parent = quizFolder
local quizTimerScript = script.TimerScript:Clone()
quizTimerScript.Parent = quizTimer
quizTimerScript.Enabled = true
local quizScore = Instance.new("IntValue")
quizScore.Name = "quizScoreValue"
quizScore.Parent = quizFolder
end)
Server Script that is being cloned
local countdown = script.Parent
local event = game:GetService("ReplicatedStorage").StartQuizNu
local lastCalled = tick()
print(lastCalled)
event.OnServerEvent:Connect(function(plr)
if tick() < lastCalled + 2 then print("Not valid") return end
lastCalled = tick()
if countdown.Value ~= 0 then return end -- Only allowed if timer is 0, either by sumbitting or if timer ran out of time naturally.
countdown.Value = 30 -- Client indicates that new question is starting and needs to restart timer.
print("Value set.")
end)
countdown:GetPropertyChangedSignal("Value"):Connect(function()
if countdown.Value == 30 then
for count = 1, 30, 1 do
count = countdown.Value
end
end
end)
Local Scripts:
Local Script for sending RemoteEvent
local event = game:GetService("ReplicatedStorage").StartQuizNu
local button = script.Parent
button.MouseButton1Up:Connect(function()
event:FireServer()
print("Sent!")
end)