Help with MouseButton1Click

Help with MouseButton1Click


Hello, I’m making this system that makes a ui pop up and it says: Do you wanna leave an ornament in the christmas tree? And then you can choose between Yes or No, is it possible to make that if you press Yes, it adds an ornament to the tree for everyone? Since the mousebutton1click script is local, and I want it to happen for everyone, it seems difficult. I also want it to appear for people that join the game after it’s been added, so I don’t think RemoteEvents would work either.
I hope you can help! :grin:

2 Likes

Change MouseButton1Click to GuiObject.Activated

I will try that, tysm I didn’t know about that feature at all

This is where the communication between the server and client comes in. You would need a remote event, and fire it from the client(local script which is where the client(whoever the dude that is doing the mouse clicking) will do his picking to the server script. In the server is where you make it visible to everyone through (remote event here).OnServerEvent:Connect(function()). If you haven’t learned this please use the youtube videos out there. This communication is extremely crucial for a lot of made features in games.

oh wait what does remoteevent:fireserver do? does it fire the event for everyone and for the ppl that join later?

FireServer fires from one of the local scripts into a script in the server, so that it can be viewed by everyone.
highly recommend watching this video: https://youtu.be/wCr5VXJ34T4

It fires the event on the server from the client side. Lets say you change colour of a part with this. It will change colour for everyone and for anyone who joins after.

ok im gonna do fireserver thats what i tried to find

Glad it worked out. Make sure to learn the parameters of FireServer(bunny,yeet) as well. In this case bunny and yeet are parameters that can be accessed by the Server from the client. They are basically information, and you can choose how ever many parameters your heart desires.

1 Like

Hello so I made this local script in the ui button:

image
and this script in StarterPlayerScripts:

image

Why is the brick not going visible? I made the remoteevent do :FireServer so it was supposed to work wasnt it?

You should put the script in gui as you are using script.parent

StarterGui or inside the ui of the button the player is pressing

Inside the text button as the variable is equal to script.parent

Still not working :frowning: I tried it inside the textbutton and StarterGui, any works, maybe FireServer isn’t what I should be using, what else should I try then.

You are supposed to use remote event in this case so you are on the right path. put the script inside the textbutton

Do you think you would be able to work better if I give you access to the game? With team-create, it would be much easier

It isnt really a big problem what you are trying to resolve just put the script inside the textbutton the player is supposed to click

I did, it doesn’t work. I already placed the script, I for some reason think that :FireServer isn’t correct, maybe it should be something like :FireClient(the dude) and from that move it to the whole server

What you are trying to achieve is to be done with a remote event. I suggest you watch some tutorials on YouTube and get a better understanding.

1 Like

FIXED, tysm everyone, now I’ll be able to use FireServers

3 Likes