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

Balefire tool won't work?

Asked by 10 years ago

Hello, I'm trying to make a Balefire tool, like the old ones of 2009. However, it doesn't seem to be working. Here's what I've tried:

print("Balefire Spell Loaded") 

local COOLDOWN = 0.1

bin = script.Parent 


function balefire(pos) 

local player = game.Players.LocalPlayer 
if player == nil or player.Character == nil then return end 

local char = player.Character.Torso 

dir = (pos - char.CFrame.p).unit 

for i = 1, 50 do 
local ex = Instance.new("Explosion") 
ex.BlastRadius = 3
ex.BlastPressure = 999999
ex.Position = char.CFrame.p + (dir * 6 * i) + (dir * 7) 
ex.Parent = game.Workspace 
end 

end 


enabled = true 
function onButton1Down(mouse) 
if not enabled then 
return 
end 

local player = game.Players.LocalPlayer 
if player == nil then return end 



enabled = false 
mouse.Icon = "rbxasset://textures\\GunWaitCursor.png"

-- find the best cf 
local cf = mouse.Hit 
local v = cf.lookVector 

script.Parent.Sound:Play()
wait(2)

balefire(cf.p) 
mouse.Icon = "rbxasset://textures\\GunCursor.png" 
enabled = true 

end 

function onSelected(mouse) 
mouse.Icon = "rbxasset://textures\\GunCursor.png" 
mouse.Button1Down:connect(function() onButton1Down(mouse) end) 
end 

bin.Selected:connect(onSelected) 

Oddly, it works in Solo and Studio, but not online.

Any help is appreciated, thanks!

1 answer

Log in to vote
1
Answered by
TopDev 0
10 years ago

Oddly, it worked for me in Play Mode. I got one error although, and that was that Sound was nil, so I just removed that part of the script for a moment and it worked, I did remove it from the script below also. Could you possibly be having the same issue? Also, if it isn't already, make the script inside of the hopperbin a LocalScript.

print("Balefire Spell Loaded") 

local COOLDOWN = 0.1

bin = script.Parent 


function balefire(pos) 

local player = game.Players.LocalPlayer 
if player == nil or player.Character == nil then return end 

local char = player.Character.Torso 

dir = (pos - char.CFrame.p).unit 

for i = 1, 50 do 
local ex = Instance.new("Explosion") 
ex.BlastRadius = 3
ex.BlastPressure = 999999
ex.Position = char.CFrame.p + (dir * 6 * i) + (dir * 7) 
ex.Parent = game.Workspace 
end 

end 


enabled = true 
function onButton1Down(mouse) 
if not enabled then 
return 
end 

local player = game.Players.LocalPlayer 
if player == nil then return end 



enabled = false 
mouse.Icon = "rbxasset://textures\\GunWaitCursor.png"

-- find the best cf 
local cf = mouse.Hit 
local v = cf.lookVector 


wait(2)

balefire(cf.p) 
mouse.Icon = "rbxasset://textures\\GunCursor.png" 
enabled = true 

end 

function onSelected(mouse) 
mouse.Icon = "rbxasset://textures\\GunCursor.png" 
mouse.Button1Down:connect(function() onButton1Down(mouse) end) 
end 

bin.Selected:connect(onSelected) 

0
I forgot to make the script a LocalScript, I made it a normal Script. Thanks! iRzPWNzr 20 — 10y
Ad

Answer this question