Idea Create a rank system using a module script that will table all the rank's icons. Problems I'm not 100% sure how to setup this code, and its not working. ModuleScript
01 | local ranks = { |
02 | Moderator = "http://www.roblox.com/asset/?id=287483807" , |
03 | PrivateBronze = "http://www.roblox.com/asset/?id=287496826" , |
04 | PrivateSilver = "http://www.roblox.com/asset/?id=287496865" , |
05 | PrivateGold = "http://www.roblox.com/asset/?id=287496901" , |
06 | CorporalBronze = "http://www.roblox.com/asset/?id=287503700" , |
07 | CorporalSilver = "http://www.roblox.com/asset/?id=287503738" , |
08 | CorporalGold = "http://www.roblox.com/asset/?id=287503811" |
09 | } |
10 |
11 | return ranks |
LocalScript
1 | ranklist = require game.ReplicatedStorage.RanksList -- I dont know |
2 | plr = game.Players.LocalPlayer |
3 | char = plr.Character |
4 | while true do |
5 | if script.Parent.Parent.Rank.Value = = 1 then |
6 | script.Parent.Image = ranklist.PrivateBronze --Help! |
7 | end |
8 | end |
Your problem is not in the Module Script.
Its in the local script
for require a module script its a function names require you need to use it like that:
1 | require(game.ReplicatedStorage.RanksList) |
and here you go.
your next error is also not an error but if you don't want to your studio crash all times you push on play you need to put a wait.
1 | while true do |
2 | --body |
3 | wait() |
4 | end |
or
1 | while wait() do |
2 | --body |
3 | end |
It will also don't work if your "script.Parent.Parent.Rank.Value" is not at 1.
now your code should look like that:
1 | ranklist = require(game.ReplicatedStorage.RanksList) |
2 | plr = game.Players.LocalPlayer |
3 | char = plr.Character |
4 | while true do |
5 | if script.Parent.Parent.Rank.Value = = 1 then |
6 | script.Parent.Image = ranklist.PrivateBronze |
7 | end |
8 | wait() |
9 | end |
and now if your image doesnt appear its maybe because of your asset.