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

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

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)

2 comments

0

ignore the 1 after activated

0

just a typo

1 answer

✓ Accepted answer

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.

1 comment

0

i meant starter gui player is defined in a top line: local player = game.Players.LocalPlayer

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