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

Why does this RemoteEvent script only work in Studio?

Asked by 9 years ago

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:

1local Model = game.Workspace.Model
2local Event = Model.RemoteEvent
3 
4script.Parent.MouseButton1Click:connect(function()
5    print("Clicked")
6    Event:FireAllClients()
7end)

Script for when it's fired:

1script.Parent.OnClientEvent:connect(function()
2    print("Fired")
3    local m = Instance.new("Message",workspace)
4    m.Text = "Test worked."
5    wait(2.5)
6    m:Destroy()
7end)
0
Does your workspace have multiple models? NinjoOnline 1146 — 9y
0
No. ISellCows 2 — 9y

1 answer

Log in to vote
0
Answered by 9 years ago

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.

Ad

Answer this question