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

How would i take information from a module script to a server script?

So i want for example change the value from the module sscript on the chicken to false but i want to change the value in the server script.

Heres my scripts. Module

local Animals = {
	["Chicken"]= {
	   ["Tameable"]= true,
	   ["Health"]= 25,	
		}	
	}

return Animals

Server Script

local h = require(game.ReplicatedStorage.Animals.ObjectStats)
print(h.Animals["Chicken"][2],false)

Error:

1:32:39.479 - ServerScriptService.Script:2: attempt to index field 'Animals' (a nil value)
17:32:39.480 - Stack Begin
17:32:39.480 - Script 'ServerScriptService.Script', Line 2
17:32:39.481 - Stack End

1 answer

✓ Accepted answer

You are indexing a value that does not exist, h is equal to the Animals table in the module script since you used return. So the correct way to index chicken would be,

local h = require(game.ReplicatedStorage.Animals.ObjectStats)

print(h.Chicken.Tameable)

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