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

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

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

2 comments

0

The problem is inside your gun script, not inside your tool giver.

0

the gun works fine when i put it on starter pack and play-test the game

1 answer

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)

1 comment

0

or maybe this

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