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

Item giving script not working properly. Is there a solution?

Asked by 3 years ago

hi there im working on an fps game and made this script for the weapon loadout menu but it dose not seem to work properly

script.Parent.Parent.HK416_Button.MouseButton1Click:Connect(function()
    local player = game.Players.LocalPlayer
    local tool = game.ReplicatedStorage.HK416:Clone()
    tool.Parent = player.Backpack
    script.Parent.Parent.Parent.Parent.SelectionGui.Enabled = false
end)

it gives the player the gun and closes the UI. but when the player equips the gun the scripts inside the gun does not work

0
The problem is inside your gun script, not inside your tool giver. Dovydas1118 1495 — 3y
0
the gun works fine when i put it on starter pack and play-test the game NexterDev 13 — 3y

1 answer

Log in to vote
-1
Answered by 3 years ago
Edited 3 years ago

I am a beginner scripter and don't know much, but this might help

local tool = game.Parent
local player = game.Players.LocalPlayer
script.Parent.ClickDetector:Connect(function(player)
    tool.Clone = Instance.new(tool, game.StarterPack)
end)

0
or maybe this ShinyPhenomenal -3 — 3y
Ad

Answer this question