|
| 26 Nov 2017 11:00 AM |
| I'm starting to learn Filtering Enabled now, and lets say a character has a ShopGui, and normally when he clicks the choice, he will get the weapon which is stored in lets say the lighting. Pretty simple, but does any of that change now that I have FE on? Do I have to fire some kind of event to tell the server something somehow? |
|
|
| Report Abuse |
|
|
Y0_dude
|
  |
| Joined: 03 Aug 2016 |
| Total Posts: 113 |
|
|
| 26 Nov 2017 11:05 AM |
You will have to give the player the weapon server sided rather then on a local script.
|
|
|
| Report Abuse |
|
|
|
| 26 Nov 2017 11:08 AM |
| So just use a server script instead of a local script? |
|
|
| Report Abuse |
|
|
Y0_dude
|
  |
| Joined: 03 Aug 2016 |
| Total Posts: 113 |
|
|
| 26 Nov 2017 11:16 AM |
You would still do everything as normal on the local script. However when making a change to the overall state of the play, in this case giving the player a tool, you signal a server script to give the player a tool rather then doing it all in a local script. In order to do this you can use remote events/functions.
|
|
|
| Report Abuse |
|
|
| |
|
Y0_dude
|
  |
| Joined: 03 Aug 2016 |
| Total Posts: 113 |
|
|
| 26 Nov 2017 11:31 AM |
--Assuming that there is a remote event called "GiveWeapon" in workspace
--In local script local event = workspace.GiveWeapon event:FireServer()
--In server script local event = workspace.GiveWeapon event.OnServerEvent:connect(function(player) local tool = SomeTool tool.parent = player.Backpack end)
|
|
|
| Report Abuse |
|
|
|
| 26 Nov 2017 11:57 AM |
| So would the local script have to be in the gui, and the server script would be where? also the gui? |
|
|
| Report Abuse |
|
|
Y0_dude
|
  |
| Joined: 03 Aug 2016 |
| Total Posts: 113 |
|
|
| 26 Nov 2017 12:00 PM |
Yes, the code in the local script should be implemented in your ShopGui and the server script should probably go into ServerScriptService.
|
|
|
| Report Abuse |
|
|
zC0LX
|
  |
| Joined: 02 Apr 2017 |
| Total Posts: 59 |
|
|
| 26 Nov 2017 12:06 PM |
script:
local s_shp = Instance.new("RemoteEvent",game.ReplicatedStorage) s_shp.Name = "give"
s_shp:OnServerEvent:connect(function(plr) local a =game.Lighting.TOOLNAMEHERE:Clone() a.Parent = game.Players:FindFirstChild(plr).Backpack end
localscript: game.ReplicatedStorage.give:FireServer(playername)
#code print('oh no an error!!') |
|
|
| Report Abuse |
|
|
|
| 26 Nov 2017 12:53 PM |
| How does the script in the serverstorage know how to get the player? Sorry, I'm just not used to this |
|
|
| Report Abuse |
|
|