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

Why does this RemoteEvent script only work in Studio?

I am trying to learn RemoteEvent's, I thought I got it to work but this only work's in studio, any suggestions on how to fix it? Output shows no errors, and doesn't print Clicked or Fired even when I use FireAllClients() in the Command Bar.

By the way FilteringEnabled is set to true.

Any help appreciated.

Script to fire it:

local Model = game.Workspace.Model
local Event = Model.RemoteEvent

script.Parent.MouseButton1Click:connect(function()
	print("Clicked")
	Event:FireAllClients()
end)

Script for when it's fired:

script.Parent.OnClientEvent:connect(function()
	print("Fired")
	local m = Instance.new("Message",workspace)
	m.Text = "Test worked."
	wait(2.5)
	m:Destroy()
end)

2 comments

0

Does your workspace have multiple models?

0

No.

1 answer

As far as I know, MouseButton1Clicked is a function of Buttons in GUIs, such as ImageButtons and TextButtons. If you're using a ClickDetector, I believe you need to use MouseClick.

However, I'm not sure why it works in Studio and not in-game.

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