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

my Tool explosion script is not working in game but only in studio and it has no errors?

my script doesn't work in game and there was no errors in the output and developer console. when I changed it to a local script it caused an error in game in developer console what should I do to fix this here's the script

local tool = script.Parent local player = game:GetService("Players").LocalPlayer debounce = false tool.Equipped:connect(function(mouse) print("Tool equipped!") mouse.Button1Down:connect(function() if debounce == true then return end debounce = true
local original = game.ServerStorage.objects.explosion -- normal explosions don't work in my -- Game because of my starter character so I have to make my own

local copy = original:Clone() copy.Parent = game.Workspace.objects copy.Position = mouse.Hit.p wait(2) debounce = false end) end)

1 comment

0

Please select this and make it a code block, I can't read it very well.

1 answer

✓ Accepted answer
local tool = script.Parent 
local player = game:GetService("Players").LocalPlayer 
debounce = false 

tool.Equipped:connect(function(mouse) 
	print("Tool equipped!") 
	mouse.Button1Down:connect(function() 
		if debounce == true then 
			return 
		end 
	debounce = true
	local original = game.ServerStorage.objects.explosion
	local copy = original:Clone() copy.Parent = game.Workspace.objects 
	copy.Position = mouse.Hit.p 
	wait(2) 
	debounce = false 
	end) 
end)

You're using a local script to handle something that should be serversided, check out Remote Events and Functions on the wiki, it should tell you all about them.

1 comment

0

sorry took so long for me to understand it

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