Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 2 years ago
    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

Log in to vote
0
Answered by 2 years ago
Edited 2 years ago

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 :)

0
so it should look like this? thedukke1 9 — 2y
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. Sarturex857 109 — 2y
Ad

Answer this question