#simple changed event not firing

53 messages · Page 1 of 1 (latest)

radiant beacon
#
    
artView.Changed:Connect(function()
    if artView.Value == true then
        script.Parent.ClickDetector.MaxActivationDistance = 0
        print("disabling click detector")
    else
        script.Parent.ClickDetector.MaxActivationDistance = 32
    end
end)

I can confirm that artView does change values multiple times while playing and not once did it print "disabling click detector

Im kinda stumped because it seems so simple yet it wont work

cold vector
radiant beacon
#

yes

#

it never prints

west sparrowBOT
#

studio** You are now Level 9! **studio

cold vector
#

Odd, my main guess at that point is that the change doesn’t replicate. Quick question, what kind of script is this and in what container is it located?

radiant beacon
#

server script located in a part

#
    print("changed")
    if artView.Value == true then
        script.Parent.ClickDetector.MaxActivationDistance = 0
        print("disabling click detector")
    else
        script.Parent.ClickDetector.MaxActivationDistance = 32
    end
end)``` 

doesnt work either so im guessing its not recognizing thats its changing
cold vector
#

Or is that the idea?

radiant beacon
#

im not sure how to do that actually i didnt know you could

#

its a singleplayer game so it doesnt matter the player'

cold vector
radiant beacon
#

i guess i can make a new local script to try

cold vector
#

Try printing the artview var. Just to check if it’s nil

cold vector
radiant beacon
#

not nil

#

what if i remove the click detector

#

well actually that wont work

#

i might just use a remote event

cold vector
radiant beacon
#

let me check but im pretty sure its client

#

yes its client

cold vector
#

Then my guess is that the change doesn’t occur on the server

#

You could then just use a remote event to be frank

radiant beacon
#

ill try doing that

cold vector
# radiant beacon ill try doing that

A hint, just make it so the client has a var like:

local artview = false

Then before firing the RE do

artview = not artview
RE:FireClient(plr, artview)

worthy portal
#

yo random person here do you mind sending a screenshot of the script i might be able to find the problem like that

cold vector
worthy portal
#

ok

radiant beacon
cold vector
radiant beacon
#

but how do i get the param of the script into the scope of the loop if that makes sense

cold vector
#

Just remember

:FireServer(Var1, Var2)

gets turned into

.OnServerEvent:Connect(function(plr, Var1, Var2)

radiant beacon
#

not loop but the if statement

cold vector
radiant beacon
#

so i would do if var 1 is true then do this else do something else?

cold vector
#

if Var = true then
set to 0
else
set to 32
end

radiant beacon
#

ah okay

radiant beacon
#

ill try

cold vector
#

Or go for some fancy bool logic

 
radiant beacon
#

i got confused there for a second

cold vector
#

Sorry, mobile copy paste, didn’t notice the text down there

radiant beacon
#

not realy sure how to go about this because it says unknown global Var1

#

im not very experienced with events

cold vector
radiant beacon
#

i did that and its returning what i wanted to

radiant beacon
#

i got it to work!

#

thank you so much