I’m making a ‘Profile System’. It works by when you click on a Player.Character part a gui will appear with all their stats.
Whenever I implement something new on my game, I first test it on a blank Baseplate. When I finished the system on the baseplate - which worked perfectly fine - and imported it to my game it breaks.
Local Script:
local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
Mouse.Button1Down:Connect(function()
local target = Mouse.Target
Print(target.Name)
If target.Parent:FindFirstChild(“Humanoid”) then
— Gui appear script
end)
ERROR: Cannot identify with “Parent”
It gets stuck on the “if target.Parent”. When I test it the target either identifies as workspace.Baseplate or nil.
Even so I still do not know why it’s throwing an error as that line is in an “if” statement so it should just output either true or false and not an error.
That’s probably because the Mouse’s TargetFilter is automatically set to the player’s character, which makes the mouse ignore it. To fix this, you can do Mouse.TargetFilter = nil at the top of the Button1Down function, so that it ignores nothing.
Also, your if statement would error if target was nil, because you’re indexing it with Parent without checking if it exists or not. To fix this, you can do if target and target.Parent:FindFirstChild("Humanoid") and it should work, since it’ll also check if target exists.
Your print would also error on nil, since you’re indexing Name directly without checking if target exists. You can also solve this by doing: print(target and target.Name) instead.
You are a freaking GENIUS my dude - All credit to @brokenVectors
Problem:
I got this Camera script that locks your Camera’s movement and also sets the fov to 1 and a lot of zoom out to give some sort of a “flat” look.