I tried to do a script, and when i runned it roblox just crashed, is this problem of my pc or script?
what does this script do, it generates position for coins, and adding them to workspace
for i = 1, 20 do
position = CFrame.new(math.random(-249,-146), 1,math.random(517,645)) + Vector3.new(math.random(47,587),0,math.random(32,999)) / 1000
local cl = nil
if math.random(1,2) == 1 then
cl = game.ReplicatedStorage.Assets["Area 1"].BoxOfCoinsModel:Clone()
else
cl = game.ReplicatedStorage.Assets["Area 1"].CoinsModel:Clone()
end
cl:SetPrimaryPartCFrame(position)
cl.Parent = workspace
end
The script instantly runs a for loop without yielding. Try adding wait() or task.wait()
for i = 1, 20 do
position = CFrame.new(math.random(-249,-146), 1,math.random(517,645)) + Vector3.new(math.random(47,587),0,math.random(32,999)) / 1000
local cl = nil
if math.random(1,2) == 1 then
cl = game.ReplicatedStorage.Assets["Area 1"].BoxOfCoinsModel:Clone()
else
cl = game.ReplicatedStorage.Assets["Area 1"].CoinsModel:Clone()
end
cl:SetPrimaryPartCFrame(position)
cl.Parent = workspace
wait() --add to yield the script
end
phew it was other script in part that i accidently writed, it was cloning it self and clone was cloning it self too so it was crashing, yeah a little bit dumb
sorry lol