I am trying to make a tazer and I keep on getting this error?
Asked by
5 years ago Edited 5 years ago
"Workspace is not a valid member of workspace"
Does anyone know how to fix this?
01 | script.Parent.Equipped:Connect( function (mouse) |
02 | mouse.Button 1 Down:Connect( function (plr) |
03 | local bullet = Instance.new( "Part" ,workspace) |
04 | bullet.Transparency = 1 |
05 | bullet.Position = script.Parent.Handle.Position |
06 | while true do wait(. 01 ) |
07 | bullet.Touched:Connect( function (plr) |
08 | if plr.Parent:FindFirstChild( "Humanoid" ) then |
09 | if plr.Parent.Name = = game.Workspace [ script.Parent.Parent.Parent.Name ] .Name then |
12 | plr.Parent.Humanoid.PlatformStand = true |
14 | plr.Parent.Humanoid.PlatformStand = false |
17 | if plr.Name = = "Handle" and plr.Parent.Name = = "Tazer" then |
19 | else bullet:Destroy() end |
edit: nvm I found the solution
01 | script.Parent.Equipped:Connect( function (mouse) |
02 | mouse.Button 1 Down:Connect( function (plr) |
03 | local player = game.Players.LocalPlayer.Name |
04 | local bullet = Instance.new( "Part" ,workspace) |
05 | bullet.Transparency = 0 |
06 | bullet.Position = workspace [ player ] .Torso.Position |
07 | while true do wait(. 01 ) |
08 | bullet.Position = Vector 3. new(bullet.Position.X + 1 ,bullet.Position.Y,bullet.Position.Z) |
09 | bullet.Touched:Connect( function (plr) |
10 | if plr.Parent:FindFirstChild( "Humanoid" ) then |
11 | if plr.Parent.Name = = game.Workspace [ player ] .Name then |
14 | plr.Parent.Humanoid.PlatformStand = true |
16 | plr.Parent.Humanoid.PlatformStand = false |
19 | if plr.Name = = "Handle" and plr.Parent.Name = = "Tazer" then |
21 | else bullet:Destroy() end |