i am developing a game and my script wont run in serverscript service(longscript) first script(in startergui inside a textbox)
timer = script.Parent
val = game.ReplicatedStorage.Timer
intro = game.ReplicatedStorage.Intro
t = game.ReplicatedStorage.T
while true do
if intro.Value == 1 then -- part that was referenced in script below
timer.Visible = true -- timer wont go visible
timer.Text = "0:"..val.Value
val.Value = val.Value - 1 -- timer wont go down a second
end
if timer.Text == "0:0" then -- this part works fine
local it = game:WaitForChild("ReplicatedStorage").It
it:FireServer()
timer.Visible = false
intro.Value = 0
timer.Text = "0.0"
end
end
this is the script with the problem(Below)
local gamie = game.ReplicatedStorage.Game
local intro = game.ReplicatedStorage.Intro
local timer = game.ReplicatedStorage.Timer
lava = game.ReplicatedStorage.Lava
local rs = game:GetService('ReplicatedStorage').Restart
local t = game:GetService("ReplicatedStorage")
rs.Event:Connect(function(touch)
timer.Value = 20 -- this is supposed to change the value of the timer to 20 to count down but that wont change either...???
intro.Value = 1 --Part that is supposed to trigger timer(as shown in script above)
local clone = game.ReplicatedStorage.Lava2:Clone()
clone.Parent = game.Workspace
if lava.Parent == game.ReplicatedStorage then
lava.Parent = game.Workspace
end
wait(1)
if lava.Parent == game.Workspace then
lava.Parent = game.ReplicatedStorage
end
wait(3)
clone:Destroy()
local tp = game.ReplicatedStorage.TP
tp.Parent = game.Workspace
end)

2 comments
And my game keeps lagging HARD it crashes studio
yeah don’t use while true do use wait wait() do