Wongus72 Posted October 14, 2019 Share Posted October 14, 2019 So I've been trying to make a character that will spawn in a certain amount of ice everyday at the same time, and preserve perishable items while it's in their inventory. How would I go about doing this? Link to comment Share on other sites More sharing options...
Serpens Posted October 14, 2019 Share Posted October 14, 2019 look at already existing code and how it is done there. eg. the white chester or the insulated backpack. And to spawn ice you can use the inst:WatchWorldState("isday", SpawnIceFunction). This function then is called at beginning of every day. Link to comment Share on other sites More sharing options...
Wongus72 Posted October 15, 2019 Author Share Posted October 15, 2019 Thank you, but now I'm encountering this problem Link to comment Share on other sites More sharing options...
Serpens Posted October 15, 2019 Share Posted October 15, 2019 8 hours ago, EscapeMan4 said: Thank you, but now I'm encountering this problem I guess you copied "inst:WatchWorldState("isday", SpawnIceFunction)" without adding any code of your own? Of course you have to define and write the SpawnIceFunction. The error message says, tha tis trying to call a function that is nil (not defined) Link to comment Share on other sites More sharing options...
Wongus72 Posted October 15, 2019 Author Share Posted October 15, 2019 12 hours ago, Serpens said: I guess you copied "inst:WatchWorldState("isday", SpawnIceFunction)" without adding any code of your own? Of course you have to define and write the SpawnIceFunction. The error message says, tha tis trying to call a function that is nil (not defined) No this is the code set for spawning ice local icee = SpawnPrefab("ice").Transform:SetPosition(inst.Transform:GetWorldPosition()) inst:WatchWorldState("isday", icee) Link to comment Share on other sites More sharing options...
Hornete Posted October 15, 2019 Share Posted October 15, 2019 26 minutes ago, EscapeMan4 said: No this is the code set for spawning ice That's not a function, you need to do something like this local function icee(inst) SpawnPrefab("ice").Transform:SetPosition(inst.Transform:GetWorldPosition()) end inst:WatchWorldState("isday", icee) Link to comment Share on other sites More sharing options...
Wongus72 Posted October 15, 2019 Author Share Posted October 15, 2019 Thank you, you both have solved my problem. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now