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

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

Asked by 6 years ago

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)

0
Please select this and make it a code block, I can't read it very well. RetroGalacticGamer 331 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago
Edited 6 years ago
01local tool = script.Parent
02local player = game:GetService("Players").LocalPlayer
03debounce = false
04 
05tool.Equipped:connect(function(mouse)
06    print("Tool equipped!")
07    mouse.Button1Down:connect(function()
08        if debounce == true then
09            return
10        end
11    debounce = true
12    local original = game.ServerStorage.objects.explosion
13    local copy = original:Clone() copy.Parent = game.Workspace.objects
14    copy.Position = mouse.Hit.p
15    wait(2)
16    debounce = false
17    end)
18end)

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.

0
sorry took so long for me to understand it noobproplayz1 -1 — 6y
Ad

Answer this question