local clickDetector = workspace.Part.ClickDetector
function onMouseClick()
print("hi world") -- code goes here
end
clickDetector.MouseClick:connect(onMouseClick)
local clickDetector = game.workspace.Part.ClickDetector local function onMouseClick() print("hi world") end clickDetector.MouseClick:Connect(onMouseClick)
If you’re still getting the error, couldn’t you just put all of your Dice Properties inside tables? I’d also use a BodyAngularVelocity & BodyVelocity to rotate the dice more easily that way, cause all you’re really just doing is setting the “Orientation” of the Dice once and that’s it
I appreciate the feedback but I’m not familiar to bodyangularvelocity or bodyvelocity. I don’t know what tables are either, but I’ll be sure to look them up on the DevHub!
Edit: I found the solution, I was typing the MouseClick function as MouseClicked
Ah gotcha, do make sure to mark the post that helped you as a solution then!
Also those objects can pretty much be used in relation to physics, for your situation though if you want: BodyVelocity could hold up the Dice easily in the air without setting the Anchored property to true, & BodyAngularVelocity can be used to spin the Dice
Ohh, right, thank you. I aren’t going to mark the post that helped me as the solution because I realised my mistake through it rather than them giving me a direct answer
Great point. I’ll post it in a reply to your comment:
Turns out I made a simple error when it came to writing out the MouseClick event. I wrote MouseClicked instead, oops!
As well as this, make sure you put the math.random() variables inside the anonymous function of the MouseClick event, otherwise you will not get a random die roll.