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
 

Re: ModuleScript not working and I have no idea why

Previous Thread :: Next Thread 
Salinas23 is not online. Salinas23
Joined: 28 Dec 2008
Total Posts: 37142
04 Apr 2016 02:47 PM
This is part of a click button script I use
--------------------------
debounce = script.Parent.Debounce
buttons = script.Parent.Bricks
local module = require(game.ServerScriptService.ButtonClicks)
gui = game.ServerStorage.Guis.MaxClicked

for a, b in pairs(buttons:GetChildren()) do
b.ClickDetector.MouseClick:connect(function(player)
module.Clicked(player, gui)
print ("Passed")


-------------------
This is the module script's function im using

function func.Clicked(player, gui)
local val = player.Character:FindFirstChild("MaxClick")
if val then
if val.Value ~= 0 then
print("value is not 0")
val.Value = val.Value -1
elseif val.Value == 0 then
print("Value is 0")
local g = gui:clone()
g.Parent = player.PlayerGui
else print("MaxClick not found") end
end
end

All it prints is ("Passed"). No error is thrown. Goes through as if there was no module function and Im running out of ideas


-Salinas con el número 23
Report Abuse
iara56 is not online. iara56
Joined: 23 Nov 2012
Total Posts: 1032
04 Apr 2016 03:05 PM
you can't acces server_script_service from the client


Report Abuse
Salinas23 is not online. Salinas23
Joined: 28 Dec 2008
Total Posts: 37142
04 Apr 2016 03:20 PM
bump of im clueless


-Salinas con el número 23
Report Abuse
DevConsole is not online. DevConsole
Joined: 02 Jun 2008
Total Posts: 460
04 Apr 2016 03:29 PM
If you told us the full scope of what you're trying to do and why for some reason you need to return the function from a module's function of it's own function (or something crazy like that I don't even remember) we could probably tell you the best way to do it.


Report Abuse
TimeTicks is not online. TimeTicks
Joined: 27 Apr 2011
Total Posts: 27115
04 Apr 2016 03:43 PM
--server script
local module = require(game.ServerScriptService.ButtonClicks)
local debounce = script.Parent.Debounce
local buttons = script.Parent.Bricks
local gui = game.ServerStorage.Guis.MaxClicked

for i, v in next, buttons:GetChildren() do
v.ClickDetector.MouseClick:connect(function(player)
module.Clicked(player,gui)
end)
end

--module script
local module = {}

module.Clicked = function(player, gui)
local val = player.Character:FindFirstChild("MaxClick")
if val then
if val.Value ~= 0 then
val.Value = val.Value - 1
else
gui:Clone().Parent = player.PlayerGui
end
end
end

return module


Report Abuse
Salinas23 is not online. Salinas23
Joined: 28 Dec 2008
Total Posts: 37142
04 Apr 2016 04:36 PM
those arent thewhole scripts

this is the whole module script

local func = {}

function func.Clicked(player, gui)
local val = player.Character:FindFirstChild("MaxClick")
if val then
if val.Value ~= 0 then
print("value is not 0")
val.Value = val.Value -1
elseif val.Value == 0 then
print("Value is 0")
local g = gui:clone()
g.Parent = player.PlayerGui
else print("MaxClick not found") end
end
end

function func.CheckValue(plr, val)
val = plr.Character:FindFirstChild("MaxClick")
if val then
return val.Value
end
end

return func


-------
this is the whole button script

debounce = script.Parent.Debounce
buttons = script.Parent.Bricks
local module = require(game.ServerScriptService.ButtonClicks)
gui = game.ServerStorage.Guis.MaxClicked

for a, b in pairs(buttons:GetChildren()) do
b.ClickDetector.MouseClick:connect(function(player)
module.Clicked(player, gui)
print ("Passed")
--local val = module.CheckValue(player)
--if val.Value ~= 0 then
if debounce.Value == false then
debounce.Value = true
for a, b in pairs (b.Parent:GetChildren()) do
b.BrickColor = BrickColor.new("Black")
end
wait(3)
for a, b in pairs (b.Parent:GetChildren()) do
b.BrickColor = BrickColor.new("Bright red")
end
debounce.Value = false
end
-- else
--end
end)
end


So no my problem is not the ends


-Salinas con el número 23
Report Abuse
Salinas23 is not online. Salinas23
Joined: 28 Dec 2008
Total Posts: 37142
04 Apr 2016 04:59 PM
FIXED THIS

I was looking for child "MaxClick", actual name was "MaxClicks"




qqqqqqqqqq


-Salinas con el número 23
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