Help with scripting [help me soon its Possible]

  1. My script dont want work More Than One Time

  2. I tired use return math but its not working no its working only one time

local math = math.random(1,2)
local click = script.Parent.ClickDetector
local function baseplatecolor(color)
	if math == 1 then
		game.Workspace.Baseplate.Color = Color3.fromRGB(0,255,0)
	end
end

local function baseplatecolor1(color2)
	if math == 2 then
		game.Workspace.Baseplate.Color = Color3.fromRGB(255,0,0)
	end
end


click.MouseClick:Connect(baseplatecolor)
click.MouseClick:Connect(baseplatecolor1)

i tired make system but its not return to start

1 Like

You need to use math.random every time you click:

local click = script.Parent.ClickDetector
local function baseplatecolor(color)
local math = math.random(1, 2) -- randomize number every time
	if math == 1 then
		game.Workspace.Baseplate.Color = Color3.fromRGB(0,255,0)
elseif math == 2 then -- merged into one function
game.Workspace.Baseplate.Color = Color3.fromRGB(255,0,0)
	end
end

click.MouseClick:Connect(baseplatecolor)
2 Likes

Thanks its actualy works thank you

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.