Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Script Wont Work?

I'm probably gonna feel really stupid when someone answer this. Why wont this work? It wont give the cloned weapon to the player who clicked the TextButton.

main = script.Parent
yesButton = main.yes
weapon = game.Lighting.TrenchGun
main2 = main.Parent
open = game.Workspace.Shotgun.open
----------------------

yesButton.MouseButton1Click:connect(function(clicked)
  print("Local player has pressed Yes")
clicked = game.Players.LocalPlayer
  weapon:Clone().Parent = clicked.Backpack
open.Value = false
main2:Destroy()
game.Workspace.Shotgun:Destroy()
end)

1 answer

✓ Accepted answer

mmmm

local player = game.Players.LocalPlayer
local gui = script.Parent
local button = gui.yes
button.MouseButton1Down:connect(function()
	local ewep = game.Lighting.TrenchGun:Clone()
	ewep.Parent = player.Backpack
	-- The rest of your code will error if Workspace.Shotgun = nil so
	if Workspace:FindFirstChild("Shotgun") then
	Workspace.Shotgun.open.Value = false
	Workspace.Shotgun:Destroy()
	script.Parent.Parent:Destroy()
	end
end)

2 comments

0

Thank you. I do feel so dumb right now. Facepalm

0

No problem and we were all new at one point, so no need to get down on yourself tbh.

This discussion is preserved as it was. New answers, comments, and votes are closed.