Problem with script(it should work)

  1. What do you want to achieve? Keep it simple and clear!
    So i need script work.
  2. What is the issue? Include screenshots / videos if possible!
    For some reason script just do nothing. I added prints, but script still do nothing.
  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I added a lot of prints, but didn’t help.

Script:

local MainPart = script.Parent.Parent.MainPart
local Player = game.Players.LocalPlayer
local FactoryBrokenValue = game.Players.LocalPlayer.PlayerGui.PlrStats.FactoryBroken
local Money = game.Players.LocalPlayer.leaderstats.Money
local Bricks = game.Players.LocalPlayer.leaderstats.Bricks
local DB = true
local MoneyLevel = script.Parent.Parent.Parent.MoneyLevel
local SpeedLevel = script.Parent.Parent.Parent.SpeedLevel
local Brick = game.Workspace.Factory1.Brick
while FactoryBrokenValue == false do
	print("FactoryBrokenValue false!")
	local BrickClone = Brick:Clone()
		BrickClone.Parent  = game.Workspace.Factory1.Brick
		BrickClone.Transparency = 0
		BrickClone.Anchored = false
			BrickClone.CanCollide = true
	if BrickClone.Position == Vector3.new(42.434, 10.789, -336.925) then
		print("Brick Position is right!")
				Bricks.Value = Bricks.Value + (1 * MoneyLevel)
		BrickClone:Destroy()
		print("Brick destroyed!")
			end
	wait(SpeedLevel)
	end

print("Smth Wrong")

A location of script:
image
(P.S. I clone entire model to workspace)

I don’t think that scripts work in server storage

Bro, could you fully read post? I wrote what i clone entire model with script in workspace.

oops my bad but if that is the case then local scripts don’t work in the workspace

Crap. Im dumb. I forgot about that. Just small question. After server was fired will while continue working infinitely before player leave?

Because the script is initially in ServerStorage, the script will never be cloned. If you want the script to run, you should make another one outside of ServerStorage.

Another man who can’t read my post fully. Bruh

I read the post, but the script is inside ServerStorage, so the part where it clones into the workspace wont run.

yea it will the server script will continue on working

Oh nvm. I read wrong. Script could be cloned in model. If you clone model with script, script will start working only when it will be cloned to other service.(except workspace and other services where local script couldn’t be executed)

Thanks a lot. Lemme make it with remote Events.