#I'm really new to scripting, would love some help.

26 messages · Page 1 of 1 (latest)

mystic parcel
#

This is the script I developed myself:
local dice = script.Parent --localizes "dice" which is the gui button

function diceroll()
local i = math.random(2,12) -- randomizes the diceroll
wait(0.1)
print(i) --prints the result
end

dice.TouchTap:Connect(diceroll())
I'm trying to sort of make a roll dice button that will print the result, this is for a future project of mine. The script is located in starter gui linked to the "dice" maybe that's the problem, idk! Anything helps! answer asap :)

steel magnet
#

Are you on mobile ?

mystic parcel
#

no, am on pc

sly salmon
#

local dice = script.Parent --localizes "dice" which is the gui button

local function diceroll()
local i = math.random(2,12) -- randomizes the diceroll
wait(0.1)
print(i) --prints the result
end

dice.Mouse1Click:Connect:(diceroll())

#

this should work or no

#

wait

steel magnet
#
local dice = script.Parent

function diceroll()
    local i = math.random(2,12)
    wait(0.1)
    print(i)
end
dice.MouseButton1Click:Connect(diceroll)

mild canyon
#

@mystic parcel is dice a button?

mystic parcel
#

@steel magnet so basically this is the very basic gui, maybe you thought it was like by clicking anywhere

mild canyon
#

@mystic parcel show the explorer (at least the part inside startgui)

sly salmon
#

he said the button was script.parent obviusly

mystic parcel
#

or maybe i am

sly salmon
#

ohhh

#

make it a local script

#

bro

#

unless you do that it wont work

mystic parcel
#

can you explain why

alpine cosmosBOT
#

studio** You are now Level 1! **studio

steel magnet
#

Connect(diceroll) not :Connect:(diceroll)

sly salmon
steel magnet
mystic parcel
#

ahhhhhhh

#

got it

#

letme try

#

Thanks you guys so much! It worked flawlessly! bigbrain