Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Local script won't send event when button clicked. Any help?

local gui = script.Parent:WaitForChild("JoinGui")

local button = gui:WaitForChild("JoinButton")

local event = script.Parent:WaitForChild("Join")

button.MouseButton1Click:Connect(function()
	
	event:FireServer(1)
	
end)

3 comments

0

The local script is fine. Do you have the script that is using .OnServerEvent, because it won’t work if you don’t have the server script for .OnServerEvent

0

i do

0

Show it

2 answers

I do not know what your server script looks like but I think mistake you possibly might have is that when you are sending 1 value on on server event you are doing this

local event = --wherever event is located
event.OnServerEvent:Connect(function(sentValue)
-- whatever you are doing
end)

but first one here is always automatically player and then comes whatever you sent from localscript

so basically if you sent :FireServer(1) then you have to do OnServerEvent(player, sentValue)

and sent value there will be that 1 you sent

I apologize for bad english, just thought this might help you because this mistake is very common

hey you! have you ever heard of enes? if you are in trouble, better call enes!

1 comment

0

can u pls help

This discussion is preserved as it was. New answers, comments, and votes are closed.