Help with value to tool button

Writing this on my ipad*

Im trying to make it so that when you click a button, a value in workspace changes to a tool name.

When you get out of that screen and go to the main menu and click play, it gives the weapons (value in workspace)

The values names are
MainValue
SecondaryValue
KnifeValue

Im just trying to make it so that when you click play, the game clones all three tools into your inventory unless the values are nothing. I tried local scripts and normal.

Well, I think that you should firstly move those values from the workspace to StarterGui so that they’re only for the player and the player only.

This makes it so whenever you click Play, you can fire a RemoteEvent to a ServerScript with your values from the play button.

Example:

local plr = game.Players.LocalPlayer

game.ReplicatedStorage.GiveTools:FireServer(plr.PlayerGui.MainValue.Value,plr.PlayerGui.SecondaryValue.Value,plr.PlayerGui.KnifeValue.Value)

Then from the ServerScript you can get all of your values from the RemoteEvent that we just fired and clone them, then parent them to the character or backpack.

1 Like

oh no. I already made a few posts on how bad I am at remotes. But I don’t want to be spoonfed again so is there another way other than remotes?

There is another way with ModuleScripts if you know how to use them and are comfortable with them.

1 Like

Try this (not tested)

  • Insert a StringValue into you button named “namechange”
  • Insert a ObjectValue into you button named “target” (point it to your target)
  • Insert a Script into your button and add the following code
-- assuming this is a button with a click detector or smth
script.Parent.ClickDetector.MouseClick:Connect(function()
        script.Parent.target.Value.Name = script.Parent.namechange.Value;
end)

Hope this example helps

Edit: The string in the stringValue is the new name

1 Like

This script is good, however he wanted it to trigger when a play button was clicked.

1 Like

Then change the trigger event to

script.Parent.UIButton.MouseButton1Click:Connect(function()
        script.Parent.target.Value.Name = script.Parent.namechange.Value
end)

Edit: Where UIButton is your UI button

1 Like

That would work aswell I suppose.

1 Like

n e v e r u s e d t h e m b e f o r e t b h

sorry my keyboard breaking but I’ve never used them before

I am 99% sure that the only option is RemoteEvents then.

1 Like

big oof then.

Now I’ll start learning remotes then

Alright! I wish you luck on that, Not_1yo.

1 Like

Okay, I made it WITHOUT using remotes. Im pretty sure it’s a bit glitchy but it saved more time