Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 2 years ago
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)
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 T3_MasterGamer 2189 — 2y
0
i do Trampyling 43 — 2y
0
Show it MattVSNNL 620 — 2y

2 answers

Log in to vote
0
Answered by 2 years ago
Edited 2 years ago

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

Ad
Log in to vote
0
Answered by
enes223 327 Moderation Voter
2 years ago

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

0
can u pls help Trampyling 43 — 2y

Answer this question