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

Hey! I Have A Problem With A Remote Function! Is There something Wrong With this?

Asked by 5 years ago

So I Have A LOCAL SCRIPT In Starter Gui Which Detects When A text button in a SCREEN GUI is clicked, the remote event does print ("Yay It Works"), Whats Wrong?

player.PlayerGui.TradeGui.LocalPlayerTrade.AcceptButton.Activated1:Connect(function()

local Player2 = player.player2trade.Value

local plrnamelocal = player.Name

game.ReplicatedStorage.TrdEvent:FireServer(Player2, plrnamelocal)

end)

0
ignore the 1 after activated mkhamster 58 — 5y
0
just a typo mkhamster 58 — 5y

1 answer

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

It is MouseButton1Click. Here is what it'd look like!

player.PlayerGui.TradeGui.LocalPlayerTrade.AcceptButton.MouseButton1Click:Connect(function()

local Player2 = player.player2trade.Value

local plrnamelocal =  [player.Name]

game.ReplicatedStorage.TrdEvent:FireServer(Player2, plrnamelocal)

end)

Where is "player" defined?

Also, I recommend NOT making the script work in the PlayerGui place. Because, it's not efficient. A good way is making it work then Clone it then make the clone in the PlayerGui.

0
i meant starter gui player is defined in a top line: local player = game.Players.LocalPlayer mkhamster 58 — 5y
Ad

Answer this question