Hi I'm trying to make a game and one of the features would be when you press a key it makes a model (cloned) and when you press it again it destroys it but its not actually letting me make the part again and idk why :( pls help
local remote = game.ReplicatedStorage.BedEvent
local currentlyhasflower = false
local model = game.ReplicatedStorage.FlowerBed:Clone()
remote.OnServerEvent:Connect(function(plr, Player)
if not currentlyhasflower then
currentlyhasflower = true
local humanoidRootPart = Player.Character.HumanoidRootPart
local cFrame = model.PrimaryPart and model.PrimaryPart.CFrame
local primaryPartCFrame = model:GetPrimaryPartCFrame()
model:SetPrimaryPartCFrame(humanoidRootPart.CFrame)
model.Parent = game.Workspace
else
model:Destroy()
currentlyhasflower = false
end
end)
