generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Script doesn't execute

Previous Thread :: Next Thread 
AVeryNerdyDude is not online. AVeryNerdyDude
Joined: 17 Apr 2009
Total Posts: 2163
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 is not online. 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
AVeryNerdyDude is not online. AVeryNerdyDude
Joined: 17 Apr 2009
Total Posts: 2163
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 is not online. 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
AVeryNerdyDude is not online. AVeryNerdyDude
Joined: 17 Apr 2009
Total Posts: 2163
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 is not online. 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
AVeryNerdyDude is not online. AVeryNerdyDude
Joined: 17 Apr 2009
Total Posts: 2163
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
AVeryNerdyDude is not online. AVeryNerdyDude
Joined: 17 Apr 2009
Total Posts: 2163
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
AVeryNerdyDude is not online. AVeryNerdyDude
Joined: 17 Apr 2009
Total Posts: 2163
21 Jun 2016 02:02 PM
bump


Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image