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: Only one command isn't working, no idea why

Previous Thread :: Next Thread 
BillTrollberg is not online. BillTrollberg
Joined: 14 Nov 2013
Total Posts: 768
01 Jan 2015 11:04 PM
if(message:sub(1,6) == ":theme") and isAdmin(Admins, plrWhoChat.Name) then
player = findTron(game.Players:GetChildren(), message:sub(8))
if player then
game.Workspace.Intro.SoundId = player.ThemeID.Value
game.Workspace.Intro:Play()
end
end

Issue:
It does absolutely nothing, and this is the only broken command.

What It SHOULD do:
1) When an admin hits the command, It will look through the player's folder for a StringValue called "ThemeID"
2) When it does, swap the SoundId for "Intro" (Located in the WorkSpace) with the Value from ThemeID
3) once all that is said and done, Play the intro music!

What I know isn't the problem:
1) Syntax (No issues here, I've had this working for a while)
2) Location (Everything works UP TO the command launch, and I can't figure out where the issue lies, as the Lua Output GUI ROBLOX made shows nothing.)
Report Abuse
BillTrollberg is not online. BillTrollberg
Joined: 14 Nov 2013
Total Posts: 768
01 Jan 2015 11:26 PM
Solved, created a work-around to solve issue.
Report Abuse
GGGGG14 is not online. GGGGG14
Joined: 29 Jan 2012
Total Posts: 25344
02 Jan 2015 12:32 AM
I suggest remodeling your admin system because basing chat syntax conditionals to run functions and change properties is not the most efficient way.
Report Abuse
BillTrollberg is not online. BillTrollberg
Joined: 14 Nov 2013
Total Posts: 768
02 Jan 2015 02:32 AM
Not efficient, maybe. But it works for now!
Report Abuse
128GB is not online. 128GB
Joined: 17 Apr 2014
Total Posts: 8056
02 Jan 2015 03:54 AM
Its not efficient because of how much memory it eats up if you add a few commands...
Report Abuse
BillTrollberg is not online. BillTrollberg
Joined: 14 Nov 2013
Total Posts: 768
02 Jan 2015 08:25 AM
I'll look into changing it, but in the mean time, only a few commands are in game.
Report Abuse
128GB is not online. 128GB
Joined: 17 Apr 2014
Total Posts: 8056
02 Jan 2015 03:52 PM
I would suggest using a table, something like



local whiteList = {
["128GB"] = true;
["BillTrollberg"] = true;
[1] = true; --Since there are no quotes this means userId, so this means ROBLOX since he is userId 1
}


local commands = {
[":theme"] = function(player)
print(player.Name .. " said :theme, I'm an example.")
end;

[":reset"] = function(player) --Another example
if player.Character then
player.Character:BreakJoints()
end
end;
}


game.Players.PlayerAdded:connect(function(player)
if (whiteList[player.Name] or whiteList[player.userId] or (player.userId == game.CreatorId)) then
player.Chatted:connect(function(input)
if commands[input:lower()] then --If there is a function in the commands table
commands[input:lower()](player) --Call the function if it exist
end
end)
end
end)
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