Cloning not working

Basically I’m making a crate system when you shoot a flare but the crate doesn’t clone

local Crate = game.ServerStorage.Crate:Clone()

	RemoteEvent.OnServerEvent:Connect(function(Player)
		wait(5)
		print("Recived Message from the Client.")
		
	wait(5)
	Crate.Position = Player.Character.Head.Position + Vector3.new(0, 400, 0)
	Crate.Parent = game.Workspace
	wait(0)
	
	local TweenService = game:GetService("TweenService")
	local Part = Crate
	local TweeningInformation = TweenInfo.new(
		10,
		Enum.EasingStyle.Quad,
		Enum.EasingDirection.Out,
		0,
		false,
		0
	)

	local PartProperties = {
		Position = Player.Character.Head.Position 
	}

	local Tween = TweenService:Create(Part,TweeningInformation,PartProperties)
	Tween:Play()

	
	wait(15)
	

	end)

Clone the crate in the event instead of outside of it?

RemoteEvent.OnServerEvent:Connect(function(Player)
	wait(5)
	print("Recived Message from the Client.")
		
	wait(5)
	local Crate = game.ServerStorage.Crate:Clone()
	Crate.Position = Player.Character.Head.Position + Vector3.new(0, 400, 0)
	Crate.Parent = game.Workspace
	wait(0)
	
	local TweenService = game:GetService("TweenService")
	local TweeningInformation = TweenInfo.new(
		10,
		Enum.EasingStyle.Quad,
		Enum.EasingDirection.Out,
		0,
		false,
		0
	)

	local PartProperties = {
		Position = Player.Character.Head.Position 
	}

	local Tween = TweenService:Create(Crate,TweeningInformation,PartProperties)
	Tween:Play()

	
	wait(15)
	

end)

Also why were you create anotehr variable to store the Crate in when you can just reference the Crate varaible itself. Also, is the crate a model or a singular part?

1 Like