Any idea how to fix this?

Here is my code:

local player = game.Players.LocalPlayer
local mouse = player:GetMouse()

repeat wait() until player.Character
local character = player.Character

local selection = Instance.new("SelectionBox",player.PlayerGui)
selection.Color = BrickColor.new("Medium stone grey")

local character = player.Character

local valid_target = character.valid_target

mouse.Icon = "http://www.roblox.com/asset/?id=184642130"
mouse.Move:connect(function()
	local target = mouse.Target
	if target ~= nil then
		local hum = target.Parent:FindFirstChild("Humanoid")
		local enemy = target.Parent:FindFirstChild("enemy")
		local player = target.Parent:FindFirstChild("player")
		local book = target.Parent:FindFirstChild("book")
		local friend = target.Parent:FindFirstChild("friend")
		if hum and target.Parent:IsA("Model") and not player and enemy then
			mouse.Icon = "http://www.roblox.com/asset/?id=165194824"
			selection.Adornee = target.Parent
			valid_target.Value = true
		elseif hum and target.Parent:IsA("Model") and not player and book then
			mouse.Icon = "http://www.roblox.com/asset/?id=186747208"
			selection.Adornee = target.Parent
			valid_target.Value = true
		elseif hum and target.Parent:IsA("Model") and not player and friend then
			mouse.Icon = "http://www.roblox.com/asset/?id=186749391"
			selection.Adornee = target.Parent
			valid_target = true
		elseif hum and target.Parnet:IsA("Model") and player then
			mouse.Icon = "http://www.roblox.com/asset/?id=186750107"
			selection.Adornee = target.Parent
			valid_target = true
		else
			mouse.Icon = "http://www.roblox.com/asset/?id=184642130"
			selection.Adornee = nil
		end
	else
		mouse.Icon = "http://www.roblox.com/asset/?id=184642130"
		selection.Adornee = nil
	end
end)

2 comments

0

Where is the script located?

0

StarterGui