This tool script is supposed to deploy an explosive strike on a position the user clicked. It works in solo mode, but when in server mode or online mode, it doesn't work at all, and I have no idea why, as output didn't give any feedback.
Can someone please help me?
Here's the script:
pospoints = script.Clicked.Value
local inactive = false
function roundedPos(pos)
local x = math.floor(pos.x)
local y = math.floor(pos.y)
local z = math.floor(pos.z)
return Vector3.new(x, y, z)
end
function b1(mouse)
m1 = mouse.Hit.p
pt1 = roundedPos(m1)
local e = Instance.new("Part")
local me = Instance.new("CylinderMesh")
me.Parent = e
e.Parent = game.Workspace
e.formFactor = "Custom"
e.Position = pt1
e.Size = Vector3.new(2, .2, 2)
e.BrickColor = BrickColor.New("Bright yellow")
e.Anchored = true
e.Transparency = .2
script.e1.Value = e
pospoints = 1
end
function b2(mouse)
local m2 = mouse.Hit.p
pt2 = roundedPos(m2)
local e = Instance.new("Part")
local me = Instance.new("CylinderMesh")
me.Parent = e
e.Parent = game.Workspace
e.formFactor = "Custom"
e.Position = pt2
e.Size = Vector3.new(2, .2, 2)
e.BrickColor = BrickColor.New("Bright yellow")
e.Anchored = true
e.Transparency = .2
script.e2.Value = e
pospoints = 2
end
function b3(mouse)
inactive = true
local m3 = mouse.Hit.p
pt3 = roundedPos(m3)
local e = Instance.new("Part")
local me = Instance.new("CylinderMesh")
me.Parent = e
e.Parent = game.Workspace
e.formFactor = "Custom"
e.Position = pt3
e.Size = Vector3.new(2, .2, 2)
e.BrickColor = BrickColor.New("Bright yellow")
e.Anchored = true
e.Transparency = .2
script.e3.Value = e
wait(1)
script.e1.Value:remove()
script.e2.Value:remove()
script.e3.Value:remove()
pospoints = 0
local n = Instance.new("Part")
n.Parent = game.Workspace
n.Position = pt1 + Vector3.new(0, 200, 0)
n.formFactor = "Custom"
n.Size = Vector3.new(0.6, 0.6, 2)
n.CFrame = n.CFrame * CFrame.fromEulerAnglesXYZ(4.65, 0, 0)
n.Name = "Mortar Missle"
local m = Instance.new("SpecialMesh")
m.Parent = n
m.MeshType = "FileMesh"
m.MeshId = "http://www.roblox.com/asset/?id=29932049"
m.TextureId = "http://www.roblox.com/asset/?id=2022906"
m.Scale = Vector3.new(1, 1, 1)
local s = Instance.new("Sound")
s.SoundId = "http://roblox.com/asset/?id=10209859"
s.Parent = n
s.Name = "MortarExplode"
s.Pitch = .2
s.Volume = 1
local sc = script.MortarBoom:clone()
sc.Disabled = false
sc.Parent = n
s.PlayOnRemove = true
wait(2)
local n = Instance.new("Part")
n.Parent = game.Workspace
n.Position = pt2 + Vector3.new(0, 200, 0)
n.formFactor = "Custom"
n.Size = Vector3.new(0.6, 0.6, 2)
n.CFrame = n.CFrame * CFrame.fromEulerAnglesXYZ(4.65, 0, 0)
n.Name = "Mortar Missle"
local m = Instance.new("SpecialMesh")
m.Parent = n
m.MeshType = "FileMesh"
m.MeshId = "http://www.roblox.com/asset/?id=29932049"
m.TextureId = "http://www.roblox.com/asset/?id=2022906"
m.Scale = Vector3.new(1, 1, 1)
local s = Instance.new("Sound")
s.SoundId = "http://roblox.com/asset/?id=10209859"
s.Parent = n
s.Name = "MortarExplode"
s.Pitch = .2
s.Volume = 1
local sc = script.MortarBoom:clone()
sc.Disabled = false
sc.Parent = n
s.PlayOnRemove = true
wait(2)
local n = Instance.new("Part")
n.Parent = game.Workspace
n.Position = pt3 + Vector3.new(0, 200, 0)
n.formFactor = "Custom"
n.Size = Vector3.new(0.6, 0.6, 2)
n.CFrame = n.CFrame * CFrame.fromEulerAnglesXYZ(4.65, 0, 0)
n.Name = "Mortar Missle"
local m = Instance.new("SpecialMesh")
m.Parent = n
m.MeshType = "FileMesh"
m.MeshId = "http://www.roblox.com/asset/?id=29932049"
m.TextureId = "http://www.roblox.com/asset/?id=2022906"
m.Scale = Vector3.new(1, 1, 1)
local s = Instance.new("Sound")
s.SoundId = "http://roblox.com/asset/?id=10209859"
s.Parent = n
s.Name = "MortarExplode"
s.Pitch = .2
s.Volume = 1
local sc = script.MortarBoom:clone()
sc.Disabled = false
sc.Parent = n
s.PlayOnRemove = true
wait(2)
script.Parent:remove()
end
function onButton1Down(mouse)
if inactive then return end
if pospoints == 0 then return b1(mouse) end
if pospoints == 1 then return b2(mouse) end
if pospoints == 2 then return b3(mouse) end
end
function onSelected(mouse)
mouse.Button1Down:connect(function() onButton1Down(mouse) end)
end
script.Parent.Selected:connect(onSelected)

2 comments
First, try saving us all time and press F9 in-game and see if there are any errors. If yes, post them here. That way, you will have higher chance of someone actually helping.
Actually got some feedback. Oddly enough, it gave it to me when I was in server mode, not online mode. It says "Clicked is not a valid member of LocalScript"