Local script inside starter gui and when the player clicks it trys to checks if its a player. If its a player it will open a gui showing that players data. But that's not happening. It errors on line 20 and says "attempt to index local 'pPlayer' (a nil value)" Otherwise it will error because I clicked on the base plate or something. Here is the script, test it yourself and fix it if you feel like it. Or just redo it.

local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local sb = script.Select
local gui = script.Parent["Game GUI"]
local hack = gui.Frames.Hack
local event = game:GetService("ReplicatedStorage").Remotes.AddCash

mouse.Move:Connect(function()
    local target = mouse.Target
	if target then
	    if target.Parent:IsA("Model") or target.Parent.Parent:IsA("Model") and game.Players:FindFirstChild(target.Parent.Name) then
	        local tPlayer = game.Players:GetPlayerFromCharacter(target.Parent)
	        sb.Adornee = tPlayer and tPlayer.Character or nil
		end			
	end
end)

mouse.Button1Up:Connect(function(tar)
	local pPlayer = game.Players:GetPlayerFromCharacter(mouse.Target.Parent or mouse.Target.Parent.Parent)
	if pPlayer:FindFirstChild("Humanoid") then
		hack.Visible = true
		hack.Title.Text = pPlayer.Name
		hack.Bitcoins.Text = tostring(pPlayer.PlayerData.Bitcoins.Value)
		hack.Steal.MouseButton1Click:Connect(function()
			event:FireServer(pPlayer.PlayerData.Bitcoins.Value)
			pPlayer.PlayerData.Bitcoins.Value = 0
		end)
	else
		
	end
end)

hack.Close.MouseButton1Click:Connect(function()
	hack.Visible = false
end)

5 comments

0

trying to an i, v in pairs loops and then do if v:IsA("Humanoid") then

0

No, because if it doesn't find it each time it clicks it will make a new loop

0

And they will build up

0

i think its because u set pPlayer as a player when humanoid is inside the character so do pPlayer.Character