#function to hide image buttons isnt working

1 messages · Page 1 of 1 (latest)

sacred sonnet
#

Script for reference:

game:GetService("ReplicatedStorage").VoteResult.OnClientEvent:Connect(function(order, stage, plr)
    print(order, stage, plr)
    pressedchap = 0
    ColorStroke(0)
    if stage == 1 then
        if order == 1 then
            ColorStroke(Chap1.UIStroke)
        elseif order == 2 then
            ColorStroke(Chap2.UIStroke)
        end
    elseif stage == 2 then
        if order == 1 then
            ColorStroke(BotMode.UIStroke)
        elseif order == 2 then
            ColorStroke(PlayerMode.UIStroke)
        end
    elseif stage == nil or order == nil then
        Chaptering(false,0)
    end    
end)```
blissful hare
#

show me the serverside

sacred sonnet
# blissful hare show me the serverside
function Select(n)
    if n == 1 then
        if Chap1Votes == Chap2Votes then
            local dice = math.round(math.random(1,2))
            if dice == 1 then
                ChapSelected = 1
            elseif dice == 2 then
                ChapSelected = 2
            end
        else
            local selection = math.max(Chap1Votes,Chap2Votes)
            if selection == Chap1Votes then
                ChapSelected = 1
            elseif selection == Chap2Votes then
                ChapSelected = 2
            end
        end
        game:GetService("ReplicatedStorage").VoteResult:FireAllClients(ChapSelected, 1)
    else
        if BotVotes == PlayerVotes then
            local dice = math.round(math.random(1,2))
            if dice == 1 then
                ModeSelected = 1
            elseif dice == 2 then
                ModeSelected = 2
            end
        else
            local selection = math.max(BotVotes,PlayerVotes)
            if selection == BotVotes then
                ModeSelected = 1
            elseif selection == PlayerVotes then
                ModeSelected = 2
            end
        end
        if GetTagsCount() <= 1 then
            ModeSelected = 1
        end
        game:GetService("ReplicatedStorage").VoteResult:FireAllClients(ModeSelected, 2)
    end
end```
fast mica
#

Thats alot 1 mib

fast mica
#

Its plr first

blissful hare
#

you only got a player if you fire client -> server

fast mica
#

On client event:connect(plr, otherstuf)

sacred sonnet
#

plr is not related?

blissful hare
#

dont do that

#

there is no player if you fire server -> client

fast mica
#

Oh yh

keen hollowBOT
#

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

fast mica
#

Right

#

Mb

blissful hare
blissful hare
sacred sonnet
fast mica
#

Im guessing the code that sets modeselected is run either after the fire client of not at all

blissful hare
fast mica
sacred sonnet
#

also why would i print it when i already have another localscxript that displays text based on nil result

fast mica
#

So you dont need that

#

Oh at the back?

blissful hare
#

bro magenta im not here to discuss things with you im here to help

sacred sonnet
#

what i mean is why does it work on a locascript but not on another localscript

fast mica
#

Should not change the script tho since only the plr would be nil

blissful hare
#

WE ARE TRYING TO FIGURE THAT OUTevilcat

#

so tell me what the prints say

fast mica
#

Chill dawg

sacred sonnet
#

ok so

#

i put unicorn print just before the hiding icons function

#

it printed unicorn

#

but for some reason it didnt execute function

fast mica
#

Wait can you send a ss of all the output?

#

Its a bit easier

blissful hare
sacred sonnet
blissful hare
#

so the issue is in the server script

sacred sonnet
blissful hare
#

print something right before you do :FireAllClients()

blissful hare
#

same server script*

sacred sonnet
#

yes

#

it also prints pegasus right before firing server

blissful hare
#

maybe the event isnt loaded yet try

game:GetService("ReplicatedStorage"):WaitForChild("VoteResult").OnClientEvent:Connect(function(order, stage)
sacred sonnet
#

what

fast mica
#

Shouldent the other one print only nil too?

sacred sonnet
#

if it didnt load yet the number values wouldnt have worked either

#

the problem is the number values work but the nil value doesnt

blissful hare
blissful hare
#

wait

#

look client things need time to load the script and prints execute but you cant wait for a event to be fired if it isnt loaded yet so we do waitforchild

fast mica
#

If its not loaded

sacred sonnet
#

1 value works
2 value works
nil value doesnt

#

how would a child unload in the middle of everything ;-;

blissful hare
#

oh my fucking god

#

yall are stressing me

sacred sonnet
#

???

#

i literally tried waitforchild and it didnt work dude

fast mica
blissful hare
#

alr great

#

I dont wanna explain allat anyway

fast mica
#

Could you print in the serverside: Modeselected

sacred sonnet
#

sure

#

it prints 1

fast mica
#

At the last last part of server try using else instead of else if

#

What

sacred sonnet
#

what

fast mica
sacred sonnet
#

why?

fast mica
#

Because the first one works too

sacred sonnet
#

what

blissful hare
#

I gtg yall got this

sacred sonnet
#
game:GetService("ReplicatedStorage").RemoteEvent.OnServerEvent:Connect(function(plr,voting)
    if voting and not timing then
        if game:GetService("ServerStorage").VoteStage.Value == 0 then
            timing = true
            stagesaved = 0
            Timer(10)
            game:GetService("ReplicatedStorage").Countdown:FireAllClients(plr, true, 1)
            stagesaved = 1
            Timer(20)
            Select(1)
            wait(2)
            game:GetService("ReplicatedStorage").Countdown:FireAllClients(plr, true, 2)
            stagesaved = 2
            Timer(20)
            Select(2)
            wait(2)
            game:GetService("ReplicatedStorage").VoteResult:FireAllClients(nil, nil)
            timing = false
        end
    end
end)```
#

this is the whole voting section script

#

as you can see it fires nil at the last part

fast mica
#

Alr

#

Remove the plr param

#

On client

#

Might cause some bugs

#

It says: (order, stage, plr)

#

Remove plr because it will always be nil

sacred sonnet
#

i did

#

it doesnt work

#

atleast now it prints nil nil my username instead of triple nil

fast mica
#

Man you got a weird scripr

#

Lol

sacred sonnet
#

anyways

#

idk what to do

#

im thinking of making yet another remoteevent

#

i didnt wanna try that bc i already have a shit ton of remote events

fast mica
#

Me neither ngl its hard to read on a phone could you send a ss?

sacred sonnet
#

of what exactly

fast mica
#

The ckde

#

Client and server

sacred sonnet
#

ok

#

@fast mica

fast mica
#

Uhhh

#

You do know that you have one line that fires the exact arguments that were "bugged"

keen hollowBOT
#

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

sacred sonnet
#

what

#

where

fast mica
#

The third fireclient on server

#

It fires nil twice

sacred sonnet
#

yes

#

i want it to send nil?

fast mica
#

So server will also be nil

sacred sonnet
#

i want it to be nil did you not understand what i said 😭

fast mica
#

Then what's the bug again?

sacred sonnet
#

client wont execute function when nil

#

it only execute stuff when theyre still number values

fast mica
#

So the function wont fire bc stage is nil?

sacred sonnet
#

i printed ebugs

#

they all print fine its the function Chaptering() where it refuses to work

#

this is chaptering

fast mica
#

So that wont fire?

sacred sonnet
#

yup

#

it doesnt even operate any service

fast mica
#

Hm

#

Let me put my thinking hat on

#

Alr add plr at the front of the first argument

#

I get it

sacred sonnet
#

which argument

blissful hare
fast mica
#

See at the third fireclient you never said which plr it goas too

sacred sonnet
fast mica
#

So it wont fire the arguments: nil, nil

sacred sonnet
#

why are you looping

fast mica
#

That's cuz i meant on the client script

sacred sonnet
blissful hare
fast mica
#

You removed it on the serer

#

Forgot it was fireall

#

I never used that

blissful hare
#

what a mess

sacred sonnet
blissful hare
#

I have no idea which script does what and what event does what and idk

#

wehn do you call chaptering

sacred sonnet
#

um

fast mica
#

Try removing the last else if on the client with x = nil or y = nil and replace it with else

#

Nvm

sacred sonnet
fast mica
#

You did check if it fired chaptering right?

sacred sonnet
#

i printed right before chaptering

#

the print works but not the function

sacred sonnet
#

how is this little thing even breaking it doesnt depend on any service

blissful hare
#

You just have no idea how to search for bugs and you are also not listening

keen hollowBOT
#

studio** You are now Level 22! **studio

sacred sonnet
fast mica
#

Well when you do fireallcients it should not need the plr argument so youre setting the first argument on the client recieving side to plr instead of what you want

blissful hare
# sacred sonnet

we are still not Waiting for the event but expecting it to be instantly be there which will cause problems on low end devices

sacred sonnet
sacred sonnet
#

i changed it for you

#

it didnt work

fast mica
#

Server: plr, false, 2---> client: print: plr, false, plr

blissful hare
#

just remove all plr arguments which are not OnServerEvent or FireClient()

sacred sonnet
fast mica
#

Yh because youre setting order to plr bc u put it in the argument

sacred sonnet
#

???

fast mica
#

The first argument of the fireallplayers is plr right?

blissful hare
fast mica
#

Which means that the first argument of the client side will also be plr

sacred sonnet
#

how is that related to chaptering

#

chaptering doesnt depend on player

blissful hare
#

it depends on the first argument

#

and as the first argument you send plr to all clients

#

which CANT be nil

sacred sonnet
#

so um i deleted player thingie and now less things are working

blissful hare
#

Magenta i think you have to rescript the whole thing

#

Ngl your code is very messy and not easy to understand

sacred sonnet
#

i already did rescript it

blissful hare
#

watch these 2 videos and try to make it again

sacred sonnet
#

everything is named are we deadass

blissful hare
#

yes

#

but the names are kinda ass tbf

sacred sonnet
#

the problem is nowhere near the names

blissful hare
#

ong im gonna crashout

#

your just talking back and not taking any advice

sacred sonnet
#

the advice in question is to rescript the wholed thing which i already did

#

only bc of one silly problem that isnt even affecting the main script

#

;-;

fast mica
blissful hare
#

even tho mine is way more complicated its much more readable cause im naming my things properly and im not nesting if statements like you are doing

sacred sonnet
#

why would nesting be fine with number but not with nil

blissful hare
#

im done

#

watch the videos take notes and come back wehn you know how to properly code

sacred sonnet
#

nah bro go crashout 🥀

blissful hare
#

and start taking some advice from people with more experience then you

sacred sonnet
#

all advice you said is "remove plr" and "restart from scratch" which i already did both

blissful hare
#

you are not understanding the foundation of the things you are using

#

thats your problem

sacred sonnet
#

no shit sherlock

#

🥀

blissful hare
#

we are trying to help you with a topic you dont understand

sacred sonnet
#

and you are failing

#

🙈

blissful hare
#

do you know what a tuple is?

sacred sonnet
#

idc rn im going for lunch

blissful hare
#

Bon appetit

#

My advice are still to watch the videos and learn from them

#

good luck

sacred sonnet
#

well

#

turns out all yall said was useless

#

i took everything inside chaptering function and stick it in the if nil then socket

#

and now it works just fine

#

;_;

blissful hare
#

Even more nesting wow! great fix