Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do i clone my car to a part away from the spawn button?

	local Clicker = script.Parent --ClickDetector
local Object = game.ReplicatedStorage:WaitForChild("Car")
local ObjectSpawn = game.Workspace:WaitForChild("Spawner") 
	 	Clicker.onClicked:Connect(function() 
	    local CloneObject = Object:Clone() 
	    CloneObject.Parent = game.Workspace 
	    ObjectSpawn.CFrame.p -- Doesnt work (has a red line)
	end)

what im trying to do is making a spawn button that spawns a car at the place where the spawner is(not the spawn button but another part) but it doesnt seem to work how do i fix

1 answer

Your script is good but that's not how you use CFrame l, to change the CFrame propertie of something you should use the equal sign '=' for it and put a CFrame value next to it(This could come from CFrame.new() or another instance's CFrame).

Example:

local part = script.Parent

part.CFrame = workspace.OtherPart.CFrame or CFrame.new(1,1,1) * CFrame.Angles(0,math.rad(90),0) -- you can use whether CFrame.new or another instance's CFrame.

Hope this helped :)

2 comments

0

so it should look like this?

0

It's just an example. You should make your one with the example I made, it's very simple if you just use another part's CFrame.

This discussion is preserved as it was. New answers, comments, and votes are closed.