#pls help me

1 messages · Page 1 of 1 (latest)

royal thicket
#

so i have a local script inside a button in screengui that generates a random number and i need the exact number in another localscript located in starterpack. I dont know how to send this between scripts and since they both local i cant use remoteevents. Can anyone help? tysm

mint flicker
mint flicker
royal thicket
#

oh

mint flicker
# royal thicket oh

Sorry about that. Had something previously copied that got pasted instead of the link I thought I copied. I edited the message!

royal thicket
#

oh

#

imma read tht

royal thicket
mint flicker
royal thicket
#

so the button should fire bindable function/event?

#

bro i do not understand this what

hazy wharfBOT
#

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

royal thicket
carmine crown
#

Instead of :FireServer or :FireAllClients / :FireClients
Its
:Fire
and
.Event

#

its pretty simple

mint flicker
royal thicket
#

i did

carmine crown
royal thicket
#

wait i might cook

#

this is what i have in the button:
local RollEvent = game.ReplicatedStorage.Roll

script.Parent.MouseButton1Click:Connect(function()
RollEvent.Event:Connect(function(data)
math.random(1,100)
end)
end)

carmine crown
royal thicket
carmine crown
royal thicket
#

uhh generate a random number but in a different script...

#

and the script is local

carmine crown
#

ts a 2 minute script dawgh

#

hol on

royal thicket
#

tysm

carmine crown
royal thicket
#

... why is there 82 11 108 108

carmine crown
# royal thicket ... why is there 82 11 108 108

im playing

local RollEvent: BindableEvent = game.ReplicatedStorage:WaitForChild("Roll") :: BindableEvent

script.Parent.MouseButton1Click:Connect(function()
    local randomNumber: number = math.random(1, 100)
    print(randomNumber)
    RollEvent:Fire(randomNumber)
end)
royal thicket
#

bruh

#

and how does the sceond script recieve this?

#

with the bindable event?

carmine crown
#

you typed it in your other script

#

but you used it incorrectly

carmine crown
#

you probably ai'd it

#

😭

forest minnow
#

IN replicated storage

#

its so stupid its smart

royal thicket
#

no i did that myself i just dont know

hazy wharfBOT
#

studio** You are now Level 2! **studio

royal thicket
#

like i get it yall are pros

forest minnow
#

intvalue in replicated storage

royal thicket
#

i am truly stupid

#

i cannot be more dumb

#

it still

#

doesnt work

#

i quit bruh

carmine crown
#

tsk

#

tsk

#

tsk...

royal thicket
#

like what

carmine crown
#

90% of gamblers quit before they win big..

royal thicket
#

there are 3 ppl helping me

carmine crown
#

and your quitting..

#

tsk tsk tsk..

royal thicket
#

with stupid

forest minnow
#

may you at least show us your scripts

royal thicket
#

script

#

...

royal thicket
carmine crown
#

you gave me the script yourself, i just modified it

#

tsk tsk tsk.

carmine crown
forest minnow
#

bro youre

forest minnow
#

so fucking trolling

#

holy shit

royal thicket
#

he is

royal thicket
forest minnow
#

paste that

#

what he wrote

royal thicket
#

definetly not

carmine crown
forest minnow
carmine crown
#

the 2nd totally works

uneven bolt
royal thicket
#

uhh anyone here?

carmine crown
#
local RollEvent = game.ReplicatedStorage:WaitForChild("Roll")

script.Parent.MouseButton1Click:Connect(function()
    local randomNumber = math.random(1, 100)
    print(randomNumber)
    RollEvent:Fire(randomNumber)
end)
forest minnow
royal thicket
#

this

carmine crown
#

or local to local?

royal thicket
#

just tell me a way to do this and youll never see me again i swear

carmine crown
#

what is reccomended then

forest minnow
#

ure gonna save

royal thicket
forest minnow
#

so much

uneven bolt
carmine crown
#

so much what

royal thicket
#

teach me this power

forest minnow
royal thicket
#

...

#

its just a number

forest minnow
#

intvalue stores numbers

#

🤯

#

u use

#

the button script

#

to generate the random number

#

u change the intvalues value to the number

royal thicket
#

ok

#

ok

#

and?

forest minnow
#

u read the changed value of the intvalue in the other script

royal thicket
#

how to read tht

forest minnow
#
IntValue.Value
carmine crown
forest minnow
#

cuh

royal thicket
#

hol up

#

i might have it

forest minnow
royal thicket
#

local RollButton = script.Parent
local RollValue = game.ReplicatedStorage.RollValue
local rng

script.Parent.MouseButton1Click:Connect(function()
rng = math.random(1,100)
RollValue.Value = rng
end)

#

is this it?

forest minnow
#

yes

#

thats just it

royal thicket
#

omgg

forest minnow
#

funny how you made rollbutton variable and not even use it

carmine crown
#

tsk tsk tsk

#

jk

forest minnow
carmine crown
#

im not dealing with ts 😭

royal thicket
#

yo guys

forest minnow
#

kid

carmine crown
#

😭

forest minnow
royal thicket
#

it sends me this

#

Players.MOO_OOOI.Backpack.Roll:15: attempt to compare Instance <= number

#

why

#

if RollValue <= 100 then
print("idk)
end

hazy wharfBOT
#

studio** You are now Level 3! **studio

royal thicket
#

@forest minnow u still here?

forest minnow
#

no

#

wasnt

#

here

royal thicket
#

ok

forest minnow
royal thicket
#

ohh

#

thanks

#

one last thing:
if RollValue <= 100000000 then
game.ReplicatedStorage.Transform:FireServer("Common")
end
it somehow doesnt fireserver when you click the button

#

@forest minnow

forest minnow
#

RollValue.Value

royal thicket
#

i did that

royal thicket
forest minnow
royal thicket
#

bro why bruh

forest minnow
#

idfk

#

oh wait

#

i do know

#

its cause youre reading the value once

#

like

forest minnow
#

everytime

#

when u do .Value everytime it reads the value that is now

#

not when at the start of the game

royal thicket
#

OH

forest minnow
#

yeah

#

yeah

royal thicket
#

IT

#

STILL

#

DOESNT WORK

#

THERE IS NO OUTPUT

#

IT JUST REFUSES TO DO ANYTHING

#

it doesnt even check for the value

#

@forest minnow please i beg

forest minnow
#

send scripts

royal thicket
#

local RollValue = game.ReplicatedStorage.RollValue

if RollValue.Value <= 100000000 then
game.ReplicatedStorage.Transform:FireServer("Common")
print("rolled common")
end
if RollValue.Value <= 10000000 then
game.ReplicatedStorage.Transform:FireServer("Uncommon")
print("rolled uncommon")
end

#

it rolls between 1 and 100000000

#

@forest minnow

forest minnow
#

can i get the full script tho

royal thicket
#

wdym

#

local player = game.Players.LocalPlayer
local Sound1m = workspace.World.Sound1m
local SoundSecret = workspace.World.SoundSecret
local SoundRoll = workspace.World.SoundRoll
local RollRemote = game.ReplicatedStorage.Roll
local RollValue = game.ReplicatedStorage.RollValue
--local RollButton = game.StarterGui.ScreenGui.RollButton
local rng = 100

--Non-Secrets
if RollValue.Value <= 100000000 then
game.ReplicatedStorage.Transform:FireServer("Common")
print("rolled common")
end
if RollValue.Value <= 10000000 then
game.ReplicatedStorage.Transform:FireServer("Uncommon")
print("rolled uncommon")
end

#

this is what i have

#

i set the int value to 100000000

#

dont mind the locals at the top

#

@forest minnow the button script works

#

???

#

@forest minnow

forest minnow
#

shhh

#
local player = game.Players.LocalPlayer
local Sound1m = workspace.World.Sound1m
local SoundSecret = workspace.World.SoundSecret
local SoundRoll = workspace.World.SoundRoll
local RollRemote = game.ReplicatedStorage.Roll
local RollValue = game.ReplicatedStorage.RollValue
--local RollButton = game.StarterGui.ScreenGui.RollButton
local rng = 100




   --Non-Secrets
if RollValue.Value <= 100000000 then
    game.ReplicatedStorage.Transform:FireServer("Common")
    print("rolled common")
end
if RollValue.Value <= 10000000 then
    game.ReplicatedStorage.Transform:FireServer("Uncommon")
    print("rolled uncommon")
end
#

not fixed just applying format

#

wait

royal thicket
#

uhh ok

forest minnow
#

wheres

#

wait

#

is this a local script

royal thicket
#

ye

forest minnow
#

also why are ther 2 ifs instead of elseif

royal thicket
#

pretty sure i said tht

forest minnow
#
if
  --
elseif
  --
end
#

??

royal thicket
#

whaat if there is more

#

ifs

#

like 3

forest minnow
#

okay what

#

is teh problem

#

it doesnt send?

royal thicket
#

wait

hazy wharfBOT
#

studio** You are now Level 4! **studio

royal thicket
#

if RollValue.Value <= 99999999 then
game.ReplicatedStorage.Transform:FireServer("Common")
print("rolled common")
elseif RollValue.Value <= 10000000 then
game.ReplicatedStorage.Transform:FireServer("Uncommon")
print("rolled uncommon")
end

#

like this @forest minnow

forest minnow
#

yes but what is the issue

royal thicket
#

well i think it doesnt read the value

royal thicket
forest minnow
#

then try setting the value to 0

royal thicket
#

doesnt work

#

man this is crazy @forest minnow

#

also why i always gotta ping you

forest minnow
#

idk man debug it or make a new post im helping another dude rn

royal thicket
#

noo

#

i--- cant

#

@carmine crown u still here,

#

?

carmine crown
royal thicket
#

can u help me

#

i drove the other guy insane

carmine crown
#

yeah

royal thicket
#

cuz it doesnt even work idk

carmine crown
#

Do what he says ig?

#

IntValue

#

heres an example

royal thicket
#

local RollButton = script.Parent
local RollValue = game.ReplicatedStorage.RollValue
local ValueLabel = RollButton.RollLabel
local rng

script.Parent.MouseButton1Click:Connect(function()
rng = math.random(1,100000000)
RollValue.Value = rng
ValueLabel.Text = RollValue.Value
end)

#

this is the button

#

local RollValue = game.ReplicatedStorage.RollValue

--Non-Secrets
if RollValue.Value <= 100000000 then
game.ReplicatedStorage.Transform:FireServer("Common")
print("rolled common")
elseif RollValue.Value <= 10000000 then
game.ReplicatedStorage.Transform:FireServer("Uncommon")
print("rolled uncommon")
end

#

this is the script

#

local*

carmine crown
#

this isj ust a number value RNG correct?

royal thicket
#

yes

carmine crown
#

ok so no need for IntValues

royal thicket
#

i just need the button to get random number into another script

#

what is blud typin so long

carmine crown
# royal thicket what is blud typin so long
--localscript 1

local button = script.Parent
local NumVal = pathtonumvalue

button.MouseButton1Click:Connect(function()
    rng = math.random(1,10000)
    NumVal.Value = rng
end)
-- localscript 2

local rollval = pathtovalue

rollval.Value.Changed:Connect(function()
  -- example code to use this
    if rollval.Value <= 100 then
        print("you suck.")
    elseif rollval.Value >= 1000 then
        print("ok cool..")
    elseif rollval.Value >= 5000 then
        print("amazing")
    elseif rollval.Value == 10000 then
        print("lucky")
    end
end)
royal thicket
#

what is pathonnumvalue

#

@carmine crown

carmine crown
royal thicket
carmine crown
#

Never used it that much

#

But if it works it works

#

🤷‍♂️

royal thicket
#

@carmine crown the .Changed doesnt work

#

u there?

#

Players.MOO_OOOI.Backpack.Roll:8: attempt to index number with 'Changed'

#

@carmine crown

#

@carmine crown

royal thicket
#

the output

royal thicket
hazy wharfBOT
#

studio** You are now Level 5! **studio

carmine crown
#

its not

rollval.Value.Changed:Connect(function()

its

royal thicket
carmine crown
#
rollval.Changed:Connect(function()
carmine crown
royal thicket
#

oh my god

#

no way

#

it..

#

it

#

works

#

@carmine crown youre the best i love you

#

omggg

#

tysm

carmine crown
royal thicket
#

it wasnt even that hard

#

i just couldnt understand bruh

carmine crown
royal thicket
carmine crown
royal thicket
#

they dont help me cuz the examples are well

#

little basic

carmine crown
royal thicket
#

im not even a beginner i just ... idk copy?

carmine crown
#

Used to do the same

royal thicket
#

well it doesnt matter now i am just happy i dod this

carmine crown
#

Dont copy from others, it wont end up well.

royal thicket
#

yeah but like you gotta learn before actually trying something yourself

carmine crown
#

Especially if you dont know what your doing

carmine crown
#

I'd reccomend watching both

#

Just to spark your mind up a little