Can you explain this part a little better, I’m a little confused sorry
If you mean to clone the StringValue instance, it isnt working because it’s trying to clone a property.
local SelectedTheme = game.Players.LocalPlayer.PlayerScripts.SelectedMap.Value
for it to work it should be:
local SelectedTheme = game.Players.LocalPlayer.PlayerScripts.SelectedMap
Sure, but is currenttheme a stringvalue or something else?
No, I’m trying to get the value because the value is the actual name of the map they selected
The current theme is the folder, the string value is called SelectedTheme
Why would you need to clone this? Just get the value, once you use it it’ll still be able to be used again!
If you want to clone the stringvalue to that folder, then do it without the .value
If you just want to get the value, then just use .value
Its hard for me to explain but basically when the player selects the map in the inventory menu, it sets the value then when the player closes the inventory menu, the map should appear there.
BUT
Since there are multiple maps I can’t just set it to Grass
(script below) for example (Grass & Lab are the two maps) because if the player has Lab
selected then it wont show, it will come up with the Grass
.
CurrentTheme:ClearAllChildren()
ThemeFolder.Grass:Clone().Parent = game.Workspace.CurrentTheme
script.Parent.Text = "Inventory"
But I want it to be the map which is in the value for the stringvalue
I will record a short video real quick to see if that can help explain it.
EDIT VIDEO
As yo can see in the video, the map just completely disappears as there is no map called “SelectedTheme”. Even though SelectedTheme is actually just the variable ( i think) of what im trying to clone.
Hence it being
local SelectedTheme = game.Players.LocalPlayer.PlayerScripts.SelectedMap.Value
edit video broke
video link here
and reply to
No, they are not. The folder where they are held is called “CurrentTheme” and it clears whenever a new map is loaded.
Are both of the maps in workspace at all times?
Wouldn’t it be easier to detect if the value changed, and then load the map based on what the new value is?
I mean, I guess but I also wanna keep it so just when the button is pressed it changes
Can’t you change the value from the button though?
The value does get changed from the button, these two.
This is the script inside them (Just changing from Grass to Lab, vise versa)
local ThemeFolder = game.ReplicatedStorage.Themes
local CurrentTheme = game.Workspace.CurrentTheme
script.Parent.MouseButton1Click:Connect(function()
CurrentTheme:ClearAllChildren()
ThemeFolder.Lab:Clone().Parent = game.Workspace.CurrentTheme
game.Players.LocalPlayer.PlayerScripts.SelectedMap.Value = "Lab"
end)
What’s the code for the close button?
If you wanna see the whole script that handles open and closing the inventory, this is it.
added annotations as i wrote if that helps
--// Showing Inventory Button Position 0.872, 0,0.473, 0
--// Hiding Inventory Button Position 1.872, 0,0.473, 0
local ThemeFolder = game.ReplicatedStorage.Themes
local CurrentTheme = game.Workspace.CurrentTheme
local MainUis = script.Parent.Parent.Parent.ClickerAndThemePicker
local InventoryFrame = script.Parent.Parent.InventoryFrame
local ShopFrame = script.Parent.Parent.Parent.ShopPlace.ShopFrame
local toggled = true
local SelectedTheme = game.Players.LocalPlayer.PlayerScripts.SelectedMap.Value
script.Parent.MouseButton1Click:Connect(function()
--// Set new map in
CurrentTheme:ClearAllChildren()
ThemeFolder.Shop:Clone().Parent = game.Workspace.CurrentTheme
if toggled == true then
toggled = false
--// Tween Shop Button for glitch-proof idea ( WIP )
ShopFrame.Parent.OpenShop:TweenPosition(UDim2.new(1.873, 0,0.414, 0), 0.5, "Linear")
--// Hide Other GUIS
MainUis.Visible = false
ShopFrame.Visible = false
InventoryFrame.Visible = true
--// Change text & toggle status
script.Parent.Text = "Close"
else if toggled == false then
toggled = true
--// Tween Shop Button for glitch-proof idea ( WIP )
ShopFrame.Parent.OpenShop:TweenPosition(UDim2.new(0.873, 0,0.414, 0), 0.5, "Linear")
--// Add back GUIS
MainUis.Visible = true
ShopFrame.Visible = false
InventoryFrame.Visible = false
--// Change text & toggle status & Set back map
CurrentTheme:ClearAllChildren()
ThemeFolder.SelectedTheme:Clone().Parent = game.Workspace.CurrentTheme
script.Parent.Text = "Inventory"
end
end
end)
Try this:
--// Showing Inventory Button Position 0.872, 0,0.473, 0
--// Hiding Inventory Button Position 1.872, 0,0.473, 0
--//Services
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
--//Variables
local LocalPlayer = Players.LocalPlayer
local PlayerScripts = LocalPlayer:WaitForChild("PlayerScripts")
local ThemeFolder = ReplicatedStorage.Themes
local CurrentTheme = workspace.CurrentTheme
local Button = script.Parent
local MainUis = Button.Parent.Parent.ClickerAndThemePicker
local InventoryFrame = Button.Parent.InventoryFrame
local ShopFrame = Button.Parent.Parent.ShopPlace.ShopFrame
--//Controls
local toggled = false
--//Functions
Button.MouseButton1Click:Connect(function()
toggled = not toggled
if toggled then
--// Tween Shop Button for glitch-proof idea ( WIP )
ShopFrame.Parent.OpenShop:TweenPosition(UDim2.new(1.873, 0,0.414, 0), 0.5, Enum.EasingStyle.Linear)
--// Hide Other GUIS
MainUis.Visible = false
ShopFrame.Visible = false
InventoryFrame.Visible = true
--// Change text & toggle status
Button.Text = "Close"
else
--// Tween Shop Button for glitch-proof idea ( WIP )
ShopFrame.Parent.OpenShop:TweenPosition(UDim2.new(0.873, 0,0.414, 0), 0.5, Enum.EasingStyle.Linear)
--// Add back GUIS
MainUis.Visible = true
ShopFrame.Visible = false
InventoryFrame.Visible = false
--// Change text & toggle status & Set back map
CurrentTheme:ClearAllChildren()
ThemeFolder.SelectedTheme:Clone().Parent = CurrentTheme
Button.Text = "Inventory"
end
end)
This script doesnt bring up the shop map ( which is this → ThemeFolder.Shop:Clone().Parent = game.Workspace.CurrentTheme
)
Aswell with this error, same as last time with the other script…
SelectedTheme is not a valid member of Folder “ReplicatedStorage.Themes”
Which is what I had in the first post on this thread.
Oh okay, try this:
--//Services
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
--//Variables
local LocalPlayer = Players.LocalPlayer
local PlayerScripts = LocalPlayer:WaitForChild("PlayerScripts")
local SelectedTheme = PlayerScripts.SelectedMap
local ThemeFolder = ReplicatedStorage.Themes
local CurrentTheme = workspace.CurrentTheme
local Button = script.Parent
local MainUis = Button.Parent.Parent.ClickerAndThemePicker
local InventoryFrame = Button.Parent.InventoryFrame
local ShopFrame = Button.Parent.Parent.ShopPlace.ShopFrame
--//Controls
local toggled = false
--//Functions
Button.MouseButton1Click:Connect(function()
toggled = not toggled
if toggled then
CurrentTheme:ClearAllChildren()
ThemeFolder.Shop:Clone().Parent = CurrentTheme
--// Tween Shop Button for glitch-proof idea ( WIP )
ShopFrame.Parent.OpenShop:TweenPosition(UDim2.new(1.873, 0,0.414, 0), 0.5, Enum.EasingStyle.Linear)
--// Hide Other GUIS
MainUis.Visible = false
ShopFrame.Visible = false
InventoryFrame.Visible = true
--// Change text & toggle status
Button.Text = "Close"
else
--// Tween Shop Button for glitch-proof idea ( WIP )
ShopFrame.Parent.OpenShop:TweenPosition(UDim2.new(0.873, 0,0.414, 0), 0.5, Enum.EasingStyle.Linear)
--// Add back GUIS
MainUis.Visible = true
ShopFrame.Visible = false
InventoryFrame.Visible = false
--// Change text & toggle status & Set back map
print(SelectedTheme.Value)
CurrentTheme:ClearAllChildren()
ThemeFolder:WaitForChild(SelectedTheme.Value):Clone().Parent = CurrentTheme
Button.Text = "Inventory"
end
end)
Tell me if it prints anything.
Wow!!! How did you get that to work?!?!
Thank you so much!!!
Along with thank you’s to @reminiscynt and @BriefYayyayyay
I got it to work by moving the:
CurrentTheme:ClearAllChildren()
ThemeFolder.Shop:Clone().Parent = game.Workspace.CurrentTheme
into the part that is fired when its actually toggled. Your old code just fired this everytime the button pressed so I’m guessing that messed up something.
If you have any more questions, feel free to ask.