Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Script Wont Work?

Asked by 10 years ago

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

Log in to vote
0
Answered by 10 years ago

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)
0
Thank you. I do feel so dumb right now. *Facepalm* RobloxHelper49 55 — 10y
0
No problem and we were all new at one point, so no need to get down on yourself tbh. flatline115 35 — 10y
Ad

Answer this question