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

RemoteEvent not working?

Asked by
DevNetx 250 Moderation Voter
8 years ago

So I've made a script that, when a button is pressed, it gathers information and sends it to my RemoteEvent, which is supposed to send it to trello.

****Original Script****

function onClicked()
    local suspect = game.Players:WaitForChild(script.Parent.Parent.reportplayer.Text)
    local caller = game.Players:WaitForChild(player.Name)
    local reason = script.Parent.Parent.reporttext.Text
    local sname = script.Parent.Parent.reportplayer.Text
-- blah blah blah
event:FireServer(suspect,caller,reason, sname)
end

****Remote Event****

function sendCall(Suspect, Caller, Reason, SuspectName)
--blah blah blah
end

local event = Instance.new('RemoteEvent', game:service'ReplicatedStorage')
event.Name = 'Call'
event.OnServerEvent:connect(sendCall)

Except it doesn't work...help?

2 answers

Log in to vote
1
Answered by 8 years ago

The first variable for OnServerEvent will always be the player who sent it. That might be where you're going wrong.

Ad
Log in to vote
0
Answered by 8 years ago

Server event listeners pass the client to the first argument of the given function, so just add an extra argument at the start of your function in the listener.

Line one of your second script should read: function sendCall(n,Suspect, Caller, Reason, SuspectName)

0
I've been trying that all morning, but it just won't work. I'm starting to think it's something to do with my GUI as when I put it in an onChatted function it works fine DevNetx 250 — 8y

Answer this question