I'm making a tree-chop script, and when the player successfully chops down a tree, the tree will take 10 seconds to respawn in a different location.
Here is my 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.Position.X = random
end
end)
Output is: X cannot be assigned to
Any help please?

1 comment
Thanks, but the thing is, it keeps spawning at the area it randomized first, and I have no idea why that happens. Perhaps you can edit your post so it'll fix the issue? Thank you!