It's me again! I made a new script for my game and I came across the same problem. This time I made sure everything was right and for some reason it doesn't work in the game. The deploy GUI button things does work, but not the buttons for the gun select.
Spawn = game.Workspace.Spawn
player = script.Parent.Parent.Parent.Parent
local Gun1 = game.ServerStorage.Gun1
local Gun2 = game.ServerStorage.Gun2
local GunSelected = Gun1,Gun2
local Player = game.Players.LocalPlayer
function onClicked()
player.Character:MoveTo(Spawn.Position)
script.Parent:Destroy()
local GunSelectedC = GunSelected:Clone()
GunSelectedC.Parent = Player.Backpack
end
script.Parent.MouseButton1Down:connect(onClicked)
script.Parent.Parent.Gun1GUI.MouseButton1Down:connect(function()
GunSelected = Gun1
print("GunSelected 1")
end)
script.Parent.Parent.Gun2GUI.MouseButton1Down:connect(function()
GunSelected = Gun2
print("GunSelected 2")
end)

11 comments
Sorry I don't know what that is. I don't think it is, but you should probably tell me what it is anyway.
Then no, I assume you will need to access the Mouse first...
Nevermind it is off
Access the mouse? What do you mean?
Read my answer below.
This is how I want it to work btw, I want to select the guns with a GUI and that works. Then I want to press the deploy button and it spawns with what gun you selected. It works in studio but not in the game. That is my plan
OH
Yeah sorry if I wasn't clear. :p
I edited my answer.
Didn't work D;
https://scriptinghelpers.org/blog/it-works-in-studio-but-not-online