Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Module Script| Help Fixing Code/Module?

Asked by 8 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.

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

local ranks = {
    Moderator = "http://www.roblox.com/asset/?id=287483807",
    PrivateBronze = "http://www.roblox.com/asset/?id=287496826",
    PrivateSilver = "http://www.roblox.com/asset/?id=287496865",
    PrivateGold = "http://www.roblox.com/asset/?id=287496901",
    CorporalBronze = "http://www.roblox.com/asset/?id=287503700",
    CorporalSilver = "http://www.roblox.com/asset/?id=287503738",
    CorporalGold = "http://www.roblox.com/asset/?id=287503811"         
    }

return ranks

LocalScript

ranklist = require game.ReplicatedStorage.RanksList -- I dont know
plr = game.Players.LocalPlayer
char = plr.Character
while true do
if script.Parent.Parent.Rank.Value == 1 then
    script.Parent.Image = ranklist.PrivateBronze --Help!
end
end

1 answer

Log in to vote
0
Answered by 8 years ago

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:

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.

while true do
--body
    wait()
end

or

while wait() do
    --body
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:

ranklist = require(game.ReplicatedStorage.RanksList)
plr = game.Players.LocalPlayer
char = plr.Character
while true do
if script.Parent.Parent.Rank.Value == 1 then
    script.Parent.Image = ranklist.PrivateBronze
end
wait()
end

and now if your image doesnt appear its maybe because of your asset.

1
Thanks, :P i was close for my fist time with modules :D pluginfactory 463 — 8y
0
You're welcome ! ;) XToonLinkX123 580 — 8y
Ad

Answer this question