In my previous question, I asked how I would make a randomized tree position every time a player chops it down. Fortunately, it was answered.
But the only thing is, that the after one randomized position, the tree always respawns in the same location. I have no idea why this happens, but it may be because of the code that was provided to me.
My current script:
local random = math.random(-100,100)
script.Parent.Changed:Connect(function()
if script.Parent.Value <= 0 then
script.Parent.Parent.CanCollide = false
script.Parent.Parent.Transparency = 1
script.Parent.Parent.Name = "cooling"
wait(10)
script.Parent.Parent.Name = "tree"
script.Parent.Parent.Transparency = 0
script.Parent.Value = 3
script.Parent.Parent.CanCollide = true
script.Parent.Parent.Position = Vector3.new(random,script.Parent.Parent.Position.Y,random);
end
end)
The script randomizes the first position of the tree, then it always respawns at the first randomized position.
Any help please?

1 comment
You too! :D