gmatch
|
  |
| Joined: 21 May 2014 |
| Total Posts: 1173 |
|
|
| 18 Jul 2017 09:35 AM |
For some odd cause this isn't firing when I press the button
// This is a ScreenGui with a TextButton in it. All located in StarterGui
script.Parent.MouseButton1Down:connect(function() game.Workspace.MyEvent:FireServer() end)
// This is a normal script, located in ServerScriptService
local event = Instance.new("RemoteEvent") event.Name = "baseplate" event.Parent = game.Workspace event.OnServerEvent:connect(function(p) game.Workspace.Baseplate.BrickColor = BrickColor.random() p.PlayerGui.ScreenGui.TextButton.BackgroundColor3 = game.Workspace.Baseplate.Color end)
Maybe it has something to do with the OnClicked part of the script thats in TextButton? I'm not sure.. I'm trying to learn how FE works so :P |
|
|
| Report Abuse |
|
|
Dratik
|
  |
| Joined: 13 Nov 2008 |
| Total Posts: 36385 |
|
|
| 18 Jul 2017 10:00 AM |
Your event is named "baseplate" and you're looking for the event "MyEvent"
|
|
|
| Report Abuse |
|
|
gmatch
|
  |
| Joined: 21 May 2014 |
| Total Posts: 1173 |
|
|
| 18 Jul 2017 10:04 AM |
| @Dratik Indeed, I recognized zed problem and changed it via ROBLOX Studio, doesn't fix my dilemma nonetheless. |
|
|
| Report Abuse |
|
|
6l8
|
  |
| Joined: 17 Jun 2014 |
| Total Posts: 4055 |
|
|
| 18 Jul 2017 10:05 AM |
Server can't access playerGui.
|
|
|
| Report Abuse |
|
|
gmatch
|
  |
| Joined: 21 May 2014 |
| Total Posts: 1173 |
|
|
| 18 Jul 2017 10:07 AM |
| @6l8 What would I apply to access PlayerGui? |
|
|
| Report Abuse |
|
|
RogueMage
|
  |
| Joined: 28 Jan 2012 |
| Total Posts: 1235 |
|
| |
|
gmatch
|
  |
| Joined: 21 May 2014 |
| Total Posts: 1173 |
|
|
| 18 Jul 2017 10:11 AM |
@RogueMage
Within which script? How would this improve anything in general? |
|
|
| Report Abuse |
|
|
RogueMage
|
  |
| Joined: 28 Jan 2012 |
| Total Posts: 1235 |
|
|
| 18 Jul 2017 10:12 AM |
Local script instead of a server script when it's parented to the GUI
Local scripts allow you to access localplayer and other cool things
wiki.roblox.com/index.php?title=API:Class/LocalScript
forum.roblox.com/Forum/ShowPost.aspx?PostID=36810971 |
|
|
| Report Abuse |
|
|
|
| 18 Jul 2017 10:20 AM |
First of all you should place your remote events into Replicated storage and not Workspace. When FE you cant access PlayerGui from server script i think. So you should do it like that.
-- Server script -- local ReplicatedStorage = game:GetService("ReplicatedStorage")
local bcEvent = Instance.new("RemoteEvent", ReplicatedStorage.Network) bcEvent.Name = "bcEvent"
bcEvent.OnServerEvent:connect(function(player) game.Workspace.Baseplate.BrickColor = BrickColor.random() end)
-- Local script -- local ReplicatedStorage = game:GetService("ReplicatedStorage") local bcEvent = ReplicatedStorage:WaitForChild("bcEvent")
script.Parent.MouseButton1Click:connect(function() bcEvent:FireServer() end)
game.Workspace.Baseplate.Changed:connect(function() script.Parent.BackgroundColor3 = game.Workspace.Baseplate.Color end)
|
|
|
| Report Abuse |
|
|
gmatch
|
  |
| Joined: 21 May 2014 |
| Total Posts: 1173 |
|
|
| 18 Jul 2017 10:26 AM |
| Aghh this #### is confusing. Thanks for all the help tho RogueMage. |
|
|
| Report Abuse |
|
|
gmatch
|
  |
| Joined: 21 May 2014 |
| Total Posts: 1173 |
|
|
| 18 Jul 2017 10:31 AM |
99XxXLuKaXxX99
Your script doesn't run for some unusual reason.
|
|
|
| Report Abuse |
|
|
gmatch
|
  |
| Joined: 21 May 2014 |
| Total Posts: 1173 |
|
| |
|
|
| 18 Jul 2017 11:21 AM |
It worked for me.
You put local script in the button, and server script into ServerScriptStorage |
|
|
| Report Abuse |
|
|
gmatch
|
  |
| Joined: 21 May 2014 |
| Total Posts: 1173 |
|
|
| 18 Jul 2017 11:23 AM |
| ServerScriptService you mean? Or ServerStorage? |
|
|
| Report Abuse |
|
|
iiNemo
|
  |
| Joined: 22 Jul 2013 |
| Total Posts: 2380 |
|
|
| 18 Jul 2017 11:24 AM |
| Put the remote event in the replicated storage first of all |
|
|
| Report Abuse |
|
|
|
| 18 Jul 2017 11:24 AM |
Ohh sory I forgot to remove Nerwork.
in server script where you create a Remote event do this.
old:
local bcEvent = Instance.new("RemoteEvent", ReplicatedStorage.Network)
It doesn't work because the parent is set to Network ( I usually store my events in Network folder and that's why I accidently put it there )
new: local bcEvent = Instance.new("RemoteEvent", ReplicatedStorage)
|
|
|
| Report Abuse |
|
|
gmatch
|
  |
| Joined: 21 May 2014 |
| Total Posts: 1173 |
|
|
| 18 Jul 2017 11:26 AM |
| I had to put it in ServerScriptService, thanks man <3 |
|
|
| Report Abuse |
|
|
gmatch
|
  |
| Joined: 21 May 2014 |
| Total Posts: 1173 |
|
|
| 18 Jul 2017 11:29 AM |
Could you add my discord? I have a few questions about FE
Discord - Goat#2976 |
|
|
| Report Abuse |
|
|
|
| 18 Jul 2017 11:30 AM |
| Np, remember to put all your events into ReplicatedStorage cuz putting them in workspace is not good practice ;D |
|
|
| Report Abuse |
|
|