|
| 21 Jun 2016 09:15 AM |
I am trying to make a place FE, but am having some issues.
This is a server script in a gui that communicates some things with the servers:
warn('loading client...') local Bindable = script.Function
Bindable.OnInvoke = function(plr) print(plr.Name) return plr.leaderstats.Tokens.Value end
script.R_E.OnServerEvent:connect(function(plr) plr.stick.type.Value = script.Parent.Parent.Type.Value end) warn('done loading client...')
The only issue is is: this doesn't even run. The warns don't output, the Bindable listeners are not connecting, it doesn't run a single line. The other odd thing is there is no error in output or anything, it just doesn't run.
I don't know why this happens, but it is extremely annoying. If anyone could tell me the issue here that would be great.
|
|
|
| Report Abuse |
|
|
pketny
|
  |
| Joined: 27 Dec 2010 |
| Total Posts: 1162 |
|
|
| 21 Jun 2016 09:37 AM |
Use a LocalScript instead of a Script?
http://wiki.roblox.com/index.php?title=API:Class/LocalScript
http://wiki.roblox.com/index.php?title=API:Class/Script |
|
|
| Report Abuse |
|
|
|
| 21 Jun 2016 10:10 AM |
But the script needs to get the value of the player's tokens from the server, not from the client. This is to make cheating almost impossible.
|
|
|
| Report Abuse |
|
|
pketny
|
  |
| Joined: 27 Dec 2010 |
| Total Posts: 1162 |
|
|
| 21 Jun 2016 10:29 AM |
Scripts that make changes to GUI's should be LocalScripts.
Run the rest on a server script in the ServerScriptService and let that execute value changing.
Make them communicate by using RemoteFunctions/Events. |
|
|
| Report Abuse |
|
|
|
| 21 Jun 2016 10:33 AM |
ServerScriptService children are protected from local scripts because of exploits. Same with ServerStorage.
The script I posted is in a server script, and the local script just has a MouseButton1Down event.
|
|
|
| Report Abuse |
|
|
pketny
|
  |
| Joined: 27 Dec 2010 |
| Total Posts: 1162 |
|
|
| 21 Jun 2016 10:46 AM |
| Please describe your problem, parenting, and which script runs what better. |
|
|
| Report Abuse |
|
|
|
| 21 Jun 2016 11:17 AM |
The parent of the script is in a frame, and the button is in the frame with the local script calling the events.
The script is a server script (which has the script i posted) and the local script is in the button.
|
|
|
| Report Abuse |
|
|
|
| 21 Jun 2016 11:43 AM |
Here is the script that is in the local script inside the button:
local plr = game.Players.LocalPlayer
script.Parent.MouseButton1Down:connect(function() warn(script.Parent.Parent.Remote.Function:Invoke(plr)) if script.Parent.Parent.Remote.Function:Invoke(plr) >= script.Parent.Parent.Cost.Value then local der = plr.StarterGear:findFirstChild(script.Parent.Parent.IN.Text) if(der==nil)then local b = plr.Backpack:GetChildren() for i=1,#b do if(b[i].ClassName=="Tool")then b[i]:Destroy() end end local b = plr.StarterGear:GetChildren() for i=1,#b do if(b[i].ClassName=="Tool")then b[i]:Destroy() end end local b = plr.Character:GetChildren() for i=1,#b do if(b[i].ClassName=="Tool")then b[i]:Destroy() end end local st = plr.Backpack.RemoteFunctions.Bindable:Invoke(script.Parent.Parent.IN.Text):Clone() st.Parent = plr.Backpack st.qPerfectionWeld.Disabled = false local weld = st:GetChildren() for i=1,#weld do if(weld[i].ClassName=="Part")then weld[i].Anchored = false end end local bst = st:Clone() bst.Parent = plr.StarterGear local weld = bst:GetChildren() for i=1,#weld do if(weld[i].ClassName=="Part")then weld[i].Anchored = false end end plr.Backpack.RemoteFunctions.R_E:FireServer() plr.Character.Humanoid.WalkSpeed = 16 script.Parent.Parent.Visible = false end end end)
|
|
|
| Report Abuse |
|
|
| |
|