Ad
Log in to vote
0

Why RemoteEvent doesn't fire from TextButton?

Asked by 14 days 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 14 days 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 19 — 14d
0
text button is in surface gui, could be that a problem? NoReal229 19 — 14d
0
yes, that is a problem. local scripts cant run in the workspace. BulletproofVast 776 — 14d
1
to fix that, you could put it (local script) in sarterplayerscripts and do something like local button = workspace.Part.SurfaceGui.TextButton BulletproofVast 776 — 14d
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 — 13d
Ad

Answer this question