|
| 24 Mar 2017 05:37 PM |
https://www.roblox.com/games/691640650/Beta-Eeny-Meeny-Miny-Moe
In this game the player clicks one of the four random parts and depending on a random chance 3 if them are incorrect and one of them are correct clicking a incorrect one will cause the Baseplate part to Cancollide off and the player will fall and die. Clicking a correct one will cause nothing to happen.
I am fairly new to scripting and i am still learning lua so my question is how would i go about creating the math.random script for my game?
-Dominatedlegacy
Update: So i was told
local n = math.random(1,4)
if Part.Value ~= n then Baseplate.CanCollide = false end
Where would i put this code? Workspace?
-Dominatedlegacy Sorry for duplicating this forum
-Dominatedlegacy |
|
|
| Report Abuse |
|
|
|
| 24 Mar 2017 05:51 PM |
| That's not going to do anything. You need to define Part and Baseplate, then I'd recommend ServerScriptService. |
|
|
| Report Abuse |
|
|
|
| 24 Mar 2017 06:18 PM |
local value = math.random(1,4) local baseplate = game.Workspace.Baseplate local part = game.Workspace.Part
function onClicked(click) if value ~= 1 then baseplate.CanCollide = false baseplate.Transparency = .5 wait(3) baseplate.Cancollide = true baseplate.Transparency = 0 script.Parent.ClickDetector.MouseClick:connect(onClicked)
this goes into the 4 random parts along with click detectors please dont just copy and paste though, read it, learn from it |
|
|
| Report Abuse |
|
|