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

Gun Working in Roblox Studio, but not in Player? PLEASE Help! Not working Properly!

So i have a Item In the shop! It is doing what it is soposed to do, but the problem is that when it loads, the Words load, but none of the scripts of the gun load properly! THIS IS A SCRIPT

wait(math.random(0, 200) / 200) --This is to prevent more than one Ignore_Model from being created

if _G.Ignore_Code then --If the Ignore_Code already exists, then the script creates the Ignore_Model
	--[[
		The purpose of this is so that every gun in a game that uses this gun kit will share one Ignore_Model. That way,
		bullet trails, bullet holes, and other fake arms will be ignored by the gun which makes the bullets more likely to
		hit a character part
	--]]
	if (not game.Workspace:FindFirstChild("Ignore_Model_".._G.Ignore_Code)) then
		local Ignore_Model = Instance.new("Model")
		Ignore_Model.Name = "Ignore_Model_".._G.Ignore_Code
		Ignore_Model.Parent = game.Workspace
	
		spawn(function()
			while true do
				Ignore_Model.Parent = game.Workspace
				wait(1 / 20)
			end
		end)
	end
	
	script.Parent:WaitForChild("Gun_Main"):WaitForChild("Ignore_Code").Value = _G.Ignore_Code
else
	--[[
		If there isn't already an Ignore_Code, then this creates one. The purpose of it being random is so that if there is
		an Ignore_Model for something else in the game, the script won't end up placing the ignored objects in that Ignore_Model
	--]]
	_G.Ignore_Code = math.random(1, 1e4)
	
	if (not game.Workspace:FindFirstChild("Ignore_Model_".._G.Ignore_Code)) then
		local Ignore_Model = Instance.new("Model")
		Ignore_Model.Name = "Ignore_Model_".._G.Ignore_Code
		Ignore_Model.Parent = game.Workspace
	
		spawn(function()
			while true do
				Ignore_Model.Parent = game.Workspace
				wait(1 / 20)
			end
		end)
	end
	
	script.Parent:WaitForChild("Gun_Main"):WaitForChild("Ignore_Code").Value = _G.Ignore_Code
end

spawn(function()
	repeat wait() until _G.Ignore_Code
	local Ignore_Model = game.Workspace:WaitForChild("Ignore_Model_".._G.Ignore_Code)
	while true do
		for _, Gun_Ignore in pairs(Ignore_Model:GetChildren()) do
			if (not game.Players:FindFirstChild(Gun_Ignore.Name:sub(12))) then
				Gun_Ignore:Destroy()
			end
		end
		wait(1 / 20)
	end
end)

The Next peice of code is A LOCAL Script, but it has over 3 thousand lines of Code, so im not going to paste it down here, But basicly it holds EVERYTHING the Gun needs to function! And the actually shooting part, The Next lines of code are trully based of of the Local Script, this is a Module Script, it contains all of the Settings this needs to Actually Work the Mode you choose it to work! I would paste the script, but it is awful long, but is there anything that i can do from all that you know of?

4 comments

0

Where is the LocalScript? Have you got FilteringEnabled on?

0

First of all, these are turbo fusion gunscripts. Second, TurboFusion gunscripts do not work with FE. If you need gun scripts that work with FE your best bet is to make your own.

0

If FE is not on, I'm not quite sure how you have your game set up but it might be worth disabling the scripts in the gun and then enabling them when you give the gun to the player.

1 answer

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