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

Hello, can someone explain why this won't work?

It's supposed to be making it so if i click with the tool (like you do with a normal tool) it fires a projectile (kinda new to scripting so the chance of this being to high level for me is very high) Thank you for answering (if you answer ofcourse)

Chara = script.Parent.Parent
mouse = Chara:GetMouse()
tool = script.Parent
   
tool.Activated:connect(onActivate)

		local Light = Instance.new('Part')
		Light.Shape = Enum.PartType.Ball
		Light.Size = Vector3.new('10, 10, 10')
		Light.Material = ('Neon')
		Light.BrickColor = BrickColor.new('New Yeller')
	Light.TopSurface = "Smooth"
	Light.BottomSurface = "Smooth"
	local y = Instance.new('BodyVelocity')
	y.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
	y.velocity = Chara.Character.Torso.CFrame.LookVector*80
	Light.Parent = game.Workspace
	y.Parent = Light
	local Deco = Instance.new('ParticleEmmiter', Light)
	Deco.Color = ColorSequence.new(255, 255, 0)
	Deco.Lifetime = NumberRange.new(3)
	Deco.Speed = 5
	Deco.Rate = 50
	Light.CFrame = Chara.Character.Toro.CfFrame*CFrame.new(0, 0, -10)
    script.Disabled = true	
	wait(6)
	Light:Destroy()
	wait(4)
	script.Disabled = false
	
end

[Output log]

20:38:28.189 - Players.Player.Backpack.Tool.Script:31: '' expected near 'end'

4 comments

0

Sorry for the accidental double post, my mouse is kinda glitched.

0

Please open the Output window! The output window is useful for checking what went wrong. Please follow this link to learn how to open the output window: http://wiki.roblox.com/index.php?title=Output . Copy any errors (red text) that you see after running this script.

1

20:33:01.591 - Players.Player.Backpack.Tool.Script:31: '' expected near 'end'

1

is what the output log said

3 answers

✓ Accepted answer

On line 24, it's Torso. You also didn't properly connect a function, as you don't have a function:

Chara = script.Parent.Parent
mouse = Chara:GetMouse()
tool = script.Parent

tool.Activated:connect(function()

    local Light = Instance.new('Part')
    Light.Shape = Enum.PartType.Ball
    Light.Size = Vector3.new('10, 10, 10')
    Light.Material = ('Neon')
    Light.BrickColor = BrickColor.new('New Yeller')
    Light.TopSurface = "Smooth"
    Light.BottomSurface = "Smooth"
    local y = Instance.new('BodyVelocity')
    y.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
    y.velocity = Chara.Character.Torso.CFrame.LookVector*80
    Light.Parent = game.Workspace
    y.Parent = Light
    local Deco = Instance.new('ParticleEmmitter', Light)
    Deco.Color = ColorSequence.new(255, 255, 0)
    Deco.Lifetime = NumberRange.new(3)
    Deco.Speed = 5
    Deco.Rate = 50
    Light.CFrame = Chara.Character.Torso.CFrame*CFrame.new(0, 0, -10)
    script.Disabled = true  
    wait(6)
    Light:Destroy()
    wait(4)
    script.Disabled = false
end)

2 comments

0

that most likely explains it thank you

0

Glad I could help.

Line 19 - Its spelled with 2 t's, not 2 m's

local Deco = Instance.new('ParticleEmmiter', Light)
local Deco = Instance.new('ParticleEmitter', Light)

1 comment

0

ah, thank you the spelling mistake

On line 24 did you mean to type in Toro? Light.CFrame = Chara.Character.Toro.CfFrame*CFrame.new(0, 0, -10)

2 comments

0

that might be the problem i'll see if it fixes it

0

It didn't fix it unfortunatly

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