|
| 17 Mar 2017 02:27 AM |
what did i do wrong? Players.Player1.Backpack.Smg.LocalScript:8: 'then' expected near '='
local tool = script.Parent local player = game:GetService("Players").LocalPlayer tool.Equipped:connect(function(mouse) print("Tool equipped!") mouse.Button1Down:connect(function() IsShooting = true if IsShooting = true then repeat until IsShooting == false print("Mouse pressed!") local ray = Ray.new(tool.Handle.CFrame.p, (mouse.Hit.p - tool.Handle.CFrame.p).unit * 100)----Range local part, position = workspace:FindPartOnRay(ray, player.Character, false, true) script.Parent.Handle.Sound:Play() local beam = Instance.new("Part", workspace) beam.BrickColor = BrickColor.new("New Yeller") beam.FormFactor = "Custom" beam.Material = "Neon" beam.Transparency = 0.25 beam.Anchored = true beam.Locked = true beam.CanCollide = false beam.Name = "beam" local distance = (tool.Handle.CFrame.p - position).magnitude beam.Size = Vector3.new(0.3, 0.3, distance) beam.CFrame = CFrame.new(tool.Handle.CFrame.p, position) * CFrame.new(0, 0, -distance / 2) game:GetService("Debris"):AddItem(beam, 0.1) if part then local humanoid = part.Parent:FindFirstChild("Zombie") if not humanoid then humanoid = part.Parent.Parent:FindFirstChild("Zombie") end if humanoid then humanoid:TakeDamage(15) end end end mouse.Button1Up:(function(mouse) IsShooting == false end) end) end)
|
|
|
| Report Abuse |
|
|
kylerzong
|
  |
| Joined: 06 Aug 2011 |
| Total Posts: 659 |
|
|
| 17 Mar 2017 02:28 AM |
if IsShooting = true then
needs to be
if IsShooting == true then |
|
|
| Report Abuse |
|
|
Bit_blox
|
  |
| Joined: 28 Aug 2016 |
| Total Posts: 974 |
|
|
| 17 Mar 2017 02:30 AM |
when you are comparing variables with an if statement, you must ALWAYS use two equal signs.
i.e. if humanoid.Health == 0 then return end
OR
i.e if not humanoid.Health == 0 then print('Humanoid isnt dead') end
either way you need doubles
- Hello world - |
|
|
| Report Abuse |
|
|
|
| 17 Mar 2017 03:14 AM |
Players.Player1.Backpack.Smg.LocalScript:42: 'name' expected near '('
this error now |
|
|
| Report Abuse |
|
|
kylerzong
|
  |
| Joined: 06 Aug 2011 |
| Total Posts: 659 |
|
| |
|
| |
|
|
| 17 Mar 2017 01:41 PM |
http://wiki.roblox.com/index.php?title=RBXScriptSignal#Methods
|
|
|
| Report Abuse |
|
|
| |
|
|
| 17 Mar 2017 02:10 PM |
seeing that everyone is too lazy to read;
mouse.Button1Up:(function(mouse) IsShooting == false end)
Setting a variable needs to be a single equal sign, not dual.
== is comparing.
mouse.Button1Up:(function(mouse) IsShooting = false end) |
|
|
| Report Abuse |
|
|
|
| 17 Mar 2017 02:11 PM |
forgot to add one thing;
you forgot to connect the event.
mouse.Button1Up:connect(function(mouse) IsShooting = false end) |
|
|
| Report Abuse |
|
|
|
| 17 Mar 2017 03:10 PM |
Players.Player1.Backpack.testt.LocalScript:38: unexpected symbol near '=' it does this
local tool = script.Parent local player = game:GetService("Players").LocalPlayer tool.Equipped:connect(function(mouse) print("Tool equipped!") mouse.Button1Up:connect(function(mouse) IsShooting = false print("Mouse pressed!") local ray = Ray.new(tool.Handle.CFrame.p, (mouse.Hit.p - tool.Handle.CFrame.p).unit * 100)----Range local part, position = workspace:FindPartOnRay(ray, player.Character, false, true) script.Parent.Handle.Sound:Play() local beam = Instance.new("Part", workspace) beam.BrickColor = BrickColor.new("New Yeller") beam.FormFactor = "Custom" beam.Material = "Neon" beam.Transparency = 0.25 beam.Anchored = true beam.Locked = true beam.CanCollide = false beam.Name = "beam" local distance = (tool.Handle.CFrame.p - position).magnitude beam.Size = Vector3.new(0.3, 0.3, distance) beam.CFrame = CFrame.new(tool.Handle.CFrame.p, position) * CFrame.new(0, 0, -distance / 2) game:GetService("Debris"):AddItem(beam, 0.1) if part then local humanoid = part.Parent:FindFirstChild("Zombie") if not humanoid then humanoid = part.Parent.Parent:FindFirstChild("Zombie") end if humanoid then humanoid:TakeDamage(15) repeat until IsShooting = true tool.Deactivated:connect(function(mouse) IsShooting = true end) end) end end end) end) |
|
|
| Report Abuse |
|
|
|
| 17 Mar 2017 03:12 PM |
Players.Player1.Backpack.testt.LocalScript:9: attempt to index local 'mouse' (a nil value) Now this one
local tool = script.Parent local player = game:GetService("Players").LocalPlayer tool.Equipped:connect(function(mouse) print("Tool equipped!") mouse.Button1Up:connect(function(mouse) IsShooting = false print("Mouse pressed!") local ray = Ray.new(tool.Handle.CFrame.p, (mouse.Hit.p - tool.Handle.CFrame.p).unit * 100)----Range local part, position = workspace:FindPartOnRay(ray, player.Character, false, true) script.Parent.Handle.Sound:Play() local beam = Instance.new("Part", workspace) beam.BrickColor = BrickColor.new("New Yeller") beam.FormFactor = "Custom" beam.Material = "Neon" beam.Transparency = 0.25 beam.Anchored = true beam.Locked = true beam.CanCollide = false beam.Name = "beam" local distance = (tool.Handle.CFrame.p - position).magnitude beam.Size = Vector3.new(0.3, 0.3, distance) beam.CFrame = CFrame.new(tool.Handle.CFrame.p, position) * CFrame.new(0, 0, -distance / 2) game:GetService("Debris"):AddItem(beam, 0.1) if part then local humanoid = part.Parent:FindFirstChild("Zombie") if not humanoid then humanoid = part.Parent.Parent:FindFirstChild("Zombie") end if humanoid then humanoid:TakeDamage(15) repeat until IsShooting == true tool.Deactivated:connect(function(mouse) IsShooting = true end) end end end) end) |
|
|
| Report Abuse |
|
|
|
| 17 Mar 2017 03:13 PM |
| local player = game.Players.LocalPlayer:GetMouse() |
|
|
| Report Abuse |
|
|
|
| 17 Mar 2017 03:14 PM |
Ops i meant this: local Mouse = player:GetMouse() |
|
|
| Report Abuse |
|
|
|
| 17 Mar 2017 03:21 PM |
| Players.Player1.Backpack.testt.LocalScript:9: attempt to index local 'mouse' (a nil value) |
|
|
| Report Abuse |
|
|
|
| 17 Mar 2017 03:24 PM |
mouse is non exsistant you're attempting to index a mouse that doesnt exist drop a line under player and do this: local mouse = player:GetMouse() |
|
|
| Report Abuse |
|
|
|
| 17 Mar 2017 03:53 PM |
Players.Player1.Backpack.testt.LocalScript:37: ')' expected (to close '(' at line 36) near 'repeat'
local tool = script.Parent local player = game:GetService("Players").LocalPlayer local mouse = player:GetMouse() tool.Equipped:connect(function(mouse) print("Tool equipped!") mouse.Button1Up:connect(function(mouse) IsShooting = false print("Mouse pressed!") local ray = Ray.new(tool.Handle.CFrame.p, (mouse.Hit.p - tool.Handle.CFrame.p).unit * 100)----Range local part, position = workspace:FindPartOnRay(ray, player.Character, false, true) script.Parent.Handle.Sound:Play() local beam = Instance.new("Part", workspace) beam.BrickColor = BrickColor.new("New Yeller") beam.FormFactor = "Custom" beam.Material = "Neon" beam.Transparency = 0.25 beam.Anchored = true beam.Locked = true beam.CanCollide = false beam.Name = "beam" local distance = (tool.Handle.CFrame.p - position).magnitude beam.Size = Vector3.new(0.3, 0.3, distance) beam.CFrame = CFrame.new(tool.Handle.CFrame.p, position) * CFrame.new(0, 0, -distance / 2) game:GetService("Debris"):AddItem(beam, 0.1) if part then local humanoid = part.Parent:FindFirstChild("Zombie") if not humanoid then humanoid = part.Parent.Parent:FindFirstChild("Zombie") end if humanoid then humanoid:TakeDamage(15 repeat until IsShooting = true tool.Deactivated:connect(function(mouse) IsShooting = true end) end) end end end) end) |
|
|
| Report Abuse |
|
|