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 5 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 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago
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.

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

Answer this question