Hello again!
I was helping my friend with a tile placement system, I’ve fixed some bugs for him, but there was a problem
when I cancel/placed a city, I can place another but the preview didn’t show
local renderThread = coroutine.create(function(player, model)
local preview = model.Preview:Clone() -- creates a new preview, the problem was probably around here
preview.Parent = game.Workspace.PreviewFolder
local mouse = mouseModule.new(player, preview) -- getting the mouse module, it worked tho (this wasn't the problem)
runService.RenderStepped:Connect(function()
if not player:GetMouse().Target then
return
end
if mouse:getMouseTarget().basepart.Parent.Name == "GridFolder" then
preview:PivotTo(CFrame.new(mouse:getMouseTarget().position + Vector3.new(0,mouse:getMouseTarget().position.Y*2,0)))
end
end)
end)
function Placement:Active() -- start the coroutine
if isServer then
return
end
coroutine.resume(renderThread, self.player, self.model)
end
function Placement:Cancel() -- cancels the placement
if isServer then
return
end
game.Workspace.PreviewFolder:ClearAllChildren()
coroutine.yield(renderThread)
end
any ideas?
I would appreciate if anyone could help, as always