idea:
make a system where, based off a variable the player is given a tool
i’m starting to get more comfortable with boblox lua, so i think i can work out how to code it, but i’m unsure where to start with this kind of system, and i also don’t know how complex it’ll end up being.
so the intention is, let’s say, the player presses a button, and then they are given a tool because they pressed that button
that’s what i’m trying to do
my main issue is that i don’t know where i’d need to start scripting, since this seems like something that you’d do in the starter player, but i don’t know.
Ah, I see. So, to clarify, if a button was named “Sword - 50 Coins”, and the player clicked that button, you’d want them to receive that sword, correct? Or a button named “Elixer - Free” will give them an Elixer when they click the button, yes?
the way that i’m trying to implement it is so that there are 3 images a player can have, each would give them a specific item
so when the player spawns in, the image loads, script grabs image id, and depending on the id they get a specific item.
i’m pretty sure i know how to do that sort of thing, since i have done stuff related to waiting for a player to join / spawn in / respawn, but i’m unsure about where i’d do this, and what the general steps are.
Okay, I need you to elaborate a bit more. I can’t help you if I don’t completely understand. You basically want these three images to be random, correct? Depending on if the image is of a stick, they’ll receive a stick. If not, and it’s a laser gun, they receive a laser gun once it’s clicked. Is that what you’re trying to do?
Alright, so right off the bat, this kind of subject isn’t 100% my specialty, however… I believe I can still help you out. You can grab decals from the toolbox and place them in a folder inside of ReplicatedStorage, or in ServerStorage if you’re planning on using a RemoteEvent. From there, you could do:
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage") -- Change to ServerStorage if you're using a RemoteEvent.
Players.PlayerAdded:Connect(function(Player)
local PlayerGui = Player:WaitForChild("PlayerGui", 30)
local ImageChance = math.random(1, 3) -- Change 3 to the amount of decals that are in your folder.
local ImageStorage = ReplicatedStorage:WaitForChild("ImageFolder", 30) -- Change this to ServerStorage if you're using a RemoteEvent. Also change the "ImageFolder" to whatever the folder in ReplicatedStorage/ServerStorage is named.
if ImageStorage and PlayerGui and ImageChance == 1 then
local ButtonImageId1 = "rbxassetid://932748192" -- Change this to one of the image Id's in your folder.
local ButtonImageId2 = "rbxassetid://47829182" -- Change this to one of the image Id's in your folder.
local ButtonImageId3 = "rbxassetid://7384059121" -- Change this to one of the image Id's in your folder.
for i, v in ipairs(ImageStorage:GetChildren()) do
if v:IsA("Decal") and v.TextureId == ButtonImageId1 then
local DesiredImage = v.Texture
local GearOptions = PlayerGui:FindFirstChild("Gear Options") -- Change this to whatever your ScreenGui name is.
if GearOptions then
local Gear1 = GearOptions.Gear1
Gear1.Image = DesiredImage
-- Continue from there.
end
end
end
end
end)