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

Why RemoteEvent doesn't fire from TextButton?

Asked by 2 years ago

Local Script

local event = game.ReplicatedStorage.Events.ACTransfer
local button = script.Parent

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

Server Script

local event = game.ReplicatedStorage.Events.ACTransfer

event.OnServerEvent:Connect(function(player)
    print(player.Name)
end)

No print

1 answer

Log in to vote
2
Answered by 2 years ago

Weird, works fine for me.

Is the local script inside of the textbutton and is the Server Script in Workspace or ServerScriptService

0
local script is in text button and server scruot is in workspace NoReal229 21 — 2y
0
text button is in surface gui, could be that a problem? NoReal229 21 — 2y
0
yes, that is a problem. local scripts cant run in the workspace. BulletproofVast 1033 — 2y
1
to fix that, you could put it (local script) in sarterplayerscripts and do something like local button = workspace.Part.SurfaceGui.TextButton BulletproofVast 1033 — 2y
1
Correction: LocalScripts run in the workspace if they are a descendant of an object owned by a player such as the player's character. The object you have in the workspace is not owned by any player, therefore it does not run. DeceptiveCaster 3761 — 2y
Ad

Answer this question