KingKamII
|
  |
| Joined: 21 Oct 2016 |
| Total Posts: 471 |
|
|
| 05 Aug 2017 04:52 PM |
Okay. So this script works in Solo Mode but not in an actual server. Nothing shows up in output either. All the variables are correct. Can somebody tell me what is wrong?
--Local Script-- In a button in a frame in a frame in a gui in PlayerGui. Lol local BuyButton = script.Parent
local function onMouseClick() local plr = game.Players.LocalPlayer local Sword = script.Parent.Parent.Config.SwordName.Value local Cost = script.Parent.Parent.Config.Cost local BuyEvent = game.ReplicatedStorage.RemoteEvents.Buy BuyEvent:FireServer(Sword,Cost) end BuyButton.MouseButton1Down:Connect(onMouseClick)
--Server Script-- In ServerScriptService --Variables local BuyEvent = game.ReplicatedStorage.RemoteEvents.Buy
--Functions BuyEvent.OnServerEvent:Connect(function(plr,Sword,Cost) local Weapon = game.ReplicatedStorage.Weapons.Swords:FindFirstChild(Sword) local Gold = plr.Data.Gold if Gold.Value >= Cost.Value then Gold.Value = Gold.Value - Cost.Value local WeaponClone = Weapon:Clone() WeaponClone.Parent = plr.Backpack else print("Nope") end end)
A wise man once told me that life is a mirror... |
|
|
| Report Abuse |
|
|
KingKamII
|
  |
| Joined: 21 Oct 2016 |
| Total Posts: 471 |
|
|
| 05 Aug 2017 04:58 PM |
B1
A wise man once told me that life is a mirror... |
|
|
| Report Abuse |
|
|
Laedere
|
  |
| Joined: 17 Jun 2013 |
| Total Posts: 23601 |
|
|
| 05 Aug 2017 04:58 PM |
I suggest you don't fire the cost locally, an exploiter can basically fire that RemoteEvent and get any sword he wants for free. If I were you, I would only fire the Sword argument then check the player's money on the server.
|
|
|
| Report Abuse |
|
|
KingKamII
|
  |
| Joined: 21 Oct 2016 |
| Total Posts: 471 |
|
|
| 05 Aug 2017 05:04 PM |
I don't see what you mean... What should I change
A wise man once told me that life is a mirror... |
|
|
| Report Abuse |
|
|
KingKamII
|
  |
| Joined: 21 Oct 2016 |
| Total Posts: 471 |
|
|
| 05 Aug 2017 05:06 PM |
I still don't see how it doesn't work in a server.
A wise man once told me that life is a mirror... |
|
|
| Report Abuse |
|
|
Laedere
|
  |
| Joined: 17 Jun 2013 |
| Total Posts: 23601 |
|
| |
|
KingKamII
|
  |
| Joined: 21 Oct 2016 |
| Total Posts: 471 |
|
|
| 05 Aug 2017 05:10 PM |
But do you see why this one is working in Solo but not in a server?
A wise man once told me that life is a mirror... |
|
|
| Report Abuse |
|
|
KingKamII
|
  |
| Joined: 21 Oct 2016 |
| Total Posts: 471 |
|
|
| 05 Aug 2017 05:16 PM |
B2
A wise man once told me that life is a mirror... |
|
|
| Report Abuse |
|
|
Laedere
|
  |
| Joined: 17 Jun 2013 |
| Total Posts: 23601 |
|
|
| 05 Aug 2017 05:17 PM |
Are you sure that you script that listens for the RemoteEvent is a regular Script and not a LocalScript?
|
|
|
| Report Abuse |
|
|
KingKamII
|
  |
| Joined: 21 Oct 2016 |
| Total Posts: 471 |
|
|
| 05 Aug 2017 05:22 PM |
100% sure
A wise man once told me that life is a mirror... |
|
|
| Report Abuse |
|
|
KingKamII
|
  |
| Joined: 21 Oct 2016 |
| Total Posts: 471 |
|
|
| 05 Aug 2017 05:26 PM |
So any ideas?
A wise man once told me that life is a mirror... |
|
|
| Report Abuse |
|
|
KingKamII
|
  |
| Joined: 21 Oct 2016 |
| Total Posts: 471 |
|
|
| 05 Aug 2017 05:29 PM |
PLZ
A wise man once told me that life is a mirror... |
|
|
| Report Abuse |
|
|
KingKamII
|
  |
| Joined: 21 Oct 2016 |
| Total Posts: 471 |
|
|
| 05 Aug 2017 05:39 PM |
B2
A wise man once told me that life is a mirror... |
|
|
| Report Abuse |
|
|