- What do you want to achieve?
I’ve created a placement system; however, the models within the “PlacementItem” in ReplicatedStorage aren’t showing up in the ScrollingFrame. I’ve created a “Template” for each model to appear in and currently only have one model in the folder.
- What is the issue?
I’ve tried to check for any errors in the output; however, I’m not getting any so it has been difficult for me to understand what’s going wrong. I’m not even sure if my placement system even works as it should because the models don’t appear in the inventory.
- What solutions have you tried so far?
I’ve looked over the scripts in the ScrollingBar, the Mod.Script in Rep.Storage, and in the Inventory & Placement scripts in ServerScriptStorage. I can’t find anything that seems to be creating this problem.
I thought I’d come to the DevForum to receive some assistance from the intelligent individuals of the forum who know much more about scripting than I do! I just started to learn how to script about 3 months ago and it’s been a slow process; however, I’m looking forward to learning how to be better from everyone here!
I’ve created a model that you can download to try and dissect the Placement System yourself in Studio since it’d probably be much more useful than reading over all the scripts in this post.
Here’s a link to the model: Auevi's Placement System (NOT WORKING YET) - Roblox
The instructions are in the Model—if you need them
Also, I know that the GUI placements are probably all wacky, I plan on fixing that in the future but I want to get the main issues fixed before doing so!
Here are all the scripts that I think are related to the issue I’m having:
AutoResizeScrollingFrame Script:
local lua_plus = require(script:WaitForChild("lua_plus"))
local ScrollingFrame = script.Parent
local UIListLayout = script.Parent:WaitForChild("UIListLayout")
local UpdateDirection = Enum.ScrollingDirection.Y
lua_plus.update_canvas_based_on_children(ScrollingFrame, UIListLayout, UpdateDirection)
ScrollingFrame.DescendantAdded:Connect(function()
wait(0.1)
lua_plus.update_canvas_based_on_children(ScrollingFrame, UIListLayout, UpdateDirection)
end)
ScrollingFrame.DescendantRemoving:Connect(function()
wait(0.1)
lua_plus.update_canvas_based_on_children(ScrollingFrame, UIListLayout, UpdateDirection)
end)
Local Script in ScrollingFrame:
local lua_plus = require(script:WaitForChild("lua_plus"))
local ScrollingFrame = script.Parent
local UIListLayout = script.Parent:WaitForChild("UIListLayout")
local UpdateDirection = Enum.ScrollingDirection.Y
lua_plus.update_canvas_based_on_children(ScrollingFrame, UIListLayout, UpdateDirection)
ScrollingFrame.DescendantAdded:Connect(function()
wait(0.1)
lua_plus.update_canvas_based_on_children(ScrollingFrame, UIListLayout, UpdateDirection)
end)
ScrollingFrame.DescendantRemoving:Connect(function()
wait(0.1)
lua_plus.update_canvas_based_on_children(ScrollingFrame, UIListLayout, UpdateDirection)
end)
Local Script in “Template” Frame:
local lua_plus = require(script:WaitForChild("lua_plus"))
local ScrollingFrame = script.Parent
local UIListLayout = script.Parent:WaitForChild("UIListLayout")
local UpdateDirection = Enum.ScrollingDirection.Y
lua_plus.update_canvas_based_on_children(ScrollingFrame, UIListLayout, UpdateDirection)
ScrollingFrame.DescendantAdded:Connect(function()
wait(0.1)
lua_plus.update_canvas_based_on_children(ScrollingFrame, UIListLayout, UpdateDirection)
end)
ScrollingFrame.DescendantRemoving:Connect(function()
wait(0.1)
lua_plus.update_canvas_based_on_children(ScrollingFrame, UIListLayout, UpdateDirection)
end)
Inventory Script in ServerScriptStorage:
local DataStoreService = game:GetService("DataStoreService"):GetDataStore("SaveData")
game.Players.PlayerAdded:Connect(function(player)
local plrid = "id_"..player.userId
local InventoryFolder = Instance.new("Folder")
InventoryFolder.Name = "InventoryFolder"
InventoryFolder.Parent = player
local FolderToStoreBuilding= Instance.new("Folder",game.Workspace)
FolderToStoreBuilding.Name = player.Name .."FolderToStoreBuilding"
----------<<<<<<Make sure that the NAME OF YOUR PLACEMENT Item is same as the Name Of the IntValue
local TeaParty = Instance.new("IntValue",InventoryFolder)
TeaParty.Name = "Tea Party"
TeaParty.Value= 0
--local Doorway =Instance.new("IntValue",InventoryFolder)
--Doorway.Value = 0
--Doorway.Name = "Doorway"
--local LargeTable =Instance.new("IntValue",InventoryFolder)
--LargeTable.Value = 0
--LargeTable.Name = "LargeTable"
--local Walls =Instance.new("IntValue",InventoryFolder)
--Walls.Value = 0
--Walls.Name = "Walls"
---------<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>....
local PlotClaimed = Instance.new("BoolValue",player)
PlotClaimed.Value = false
PlotClaimed.Name = "PlotClaimed"
local GetData = DataStoreService:GetAsync(plrid)
if GetData then
TeaParty.Value = GetData[1]
--Doorway.Value = GetData[2]
--Walls.Value = GetData[3]
--LargeTable.Value = GetData[4]
else
local CurrencySave = {TeaParty.Value--,Doorway.Value,LargeTable.Value,Walls.Value
}
DataStoreService:GetAsync(plrid, CurrencySave)
end
end)
game.Players.PlayerRemoving:Connect(function(plr)
if plr:WaitForChild("PlotClaimed").Value == true then
for i ,v in pairs(game.Workspace:WaitForChild("PlotFolder"):GetDescendants()) do
if v:IsA("StringValue") and v.Name == "PlayerName" then
if v.Value == tostring(plr.Name) then
v.Value = ""
v.Parent:WaitForChild("PlotClaim").Value = false
v.Parent:WaitForChild("PlayerNamePart"):FindFirstChild("SurfaceGui").PlayerNameLabel.Text = ""
end
end
end
end
DataStoreService:SetAsync("id_"..plr.UserId, {plr.InventoryFolder.TeaParty.Value
--, plr.InventoryFolder.Doorway.Value,
--plr.InventoryFolder.Walls.Value,
--plr.InventoryFolder.LargeTable.Value
})
end)
InventoryModuleScript in ReplicatedStorage:
local module = {}
module.InventoryInfo = {
["TeaParty"] = {
["ItemName"] = "Tea Party",
["Description"] = "Blahblahblah",
["Icon"] = "rbxassetid://".. "4333953029"
}--,
--ADD NEW MODEL HERE
--["Tea Party"] = {
--["ItemName"] = "Tea Party",
--["Description"] = "Blahblahblah"
--["Icon"] = "place image ID here",
}
return module
Thank you soooo much for your help! It’s greatly and truly appreciated. I wanted to make this a model that players can use in their games and to also learn how to script as well I also would like to use it for one of my games as well.
Please let me know if I can give you anymore information!