So I made a dice game as a project, and i used a button so when it got clicked it would make the CFrame of the dice change its orientation, and position so it could reroll. When I click on the button however, the dice just spawn on the ground. What do i do?
local clickDetector = script.Parent:WaitForChild("ClickDetector")
function onMouseClick()
local dice1data = Vector3.new(-35, 53.5, -52) local dice2data = Vector3.new(-35, 68.5, -29) local CFrame1 = CFrame.new(dice1data) local CFrame2 = CFrame.new(dice2data) local CFrameorient1 = CFrame.Angles(30, -54.74, -35.26) local Cframeorient2 = CFrame.Angles(-30, 35.26, 35.26) local dice1 = game.Workspace.Dice1 local dice2 = game.Workspace.Dice2 game.Workspace.Dice1.CFrame = CFrame1 and CFrameorient1 game.Workspace.Dice2.CFrame = CFrame2 and Cframeorient2
end
clickDetector.MouseClick:connect(onMouseClick)
This is my script.