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

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?

script.Parent.Equipped:Connect(function(mouse)
    mouse.Button1Down:Connect(function(plr)
        local bullet = Instance.new("Part",workspace)
        bullet.Transparency = 1
        bullet.Position = script.Parent.Handle.Position
        while true do wait(.01)
            bullet.Touched:Connect(function(plr)
                if plr.Parent:FindFirstChild("Humanoid") then
                    if plr.Parent.Name == game.Workspace[script.Parent.Parent.Parent.Name].Name then
                        wait(.1)
                    else
                        plr.Parent.Humanoid.PlatformStand = true
                        wait(5)
                        plr.Parent.Humanoid.PlatformStand = false
                    end
                else
                    if plr.Name == "Handle" and plr.Parent.Name == "Tazer" then
                        --nothing
                    else bullet:Destroy() end
                end 
            end)
        end
    end)
end)

edit: nvm I found the solution

script.Parent.Equipped:Connect(function(mouse)
    mouse.Button1Down:Connect(function(plr)
        local player = game.Players.LocalPlayer.Name
        local bullet = Instance.new("Part",workspace)
        bullet.Transparency = 0
        bullet.Position = workspace[player].Torso.Position
        while true do wait(.01)
            bullet.Position = Vector3.new(bullet.Position.X + 1,bullet.Position.Y,bullet.Position.Z)
            bullet.Touched:Connect(function(plr)
                if plr.Parent:FindFirstChild("Humanoid") then
                    if plr.Parent.Name == game.Workspace[player].Name then
                        wait(.1)
                    else
                        plr.Parent.Humanoid.PlatformStand = true
                        wait(5)
                        plr.Parent.Humanoid.PlatformStand = false
                    end
                else
                    if plr.Name == "Handle" and plr.Parent.Name == "Tazer" then
                        --nothing
                    else bullet:Destroy() end
                end 
            end)
        end
    end)
end)
0
Please find which line it says, if it says it in the error code. ghxstlvty 133 — 5y

Answer this question