Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Module Script| Help Fixing Code/Module?

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

✓ Accepted answer

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.

2 comments

1

Thanks, :P i was close for my fist time with modules :D

0

You're welcome ! ;)

This discussion is preserved as it was. New answers, comments, and votes are closed.