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

RemoteEvent not working?

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

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

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)

1 comment

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

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