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

how to make a model rotate when cloned?

Asked by 5 years ago
Edited 5 years ago

hi im making a gun game and i'm making the shop right now and when you click on a button the gun will pop up in front of you for a preview but i get the clone and stuff right but then it stops to rotate here is my 2 scripts

----clone and re position-----

script.Parent.MouseButton1Click:Connect(function()
    script.Parent.Parent.Parent.Parent.info.weponchange:FireServer()
    local gun = game.Workspace.Gun.Ak47:Clone()
    gun.Parent = game.Workspace 
    gun:SetPrimaryPartCFrame(CFrame.new(242.691, 37.99, -1664.28))  
    local selection = Instance.new("SelectionBox")
    selection.Color3 = Color3.new(0.6,0.6,0.6)
    selection.Transparency = 1
    selection.Name = "car"
    selection.Parent = game.Players.LocalPlayer.PlayerGui
    selection.Adornee = gun

end)

----- rotate --------

local X     
local Y         
local Z         


X= 0


Y= 1



Z= 0



function start() 
    while (true) do 
        script.Parent:SetPrimaryPartCFrame(script.Parent.PrimaryPart.CFrame * CFrame.fromEulerAnglesXYZ(math.rad(X),math.rad(Y),math.rad(Z)))
        wait() 
    end             
end                 

start() 








Answer this question