This script works perfectly, but when I reset my character it stops working.
Any idea why?
This script is a Local Script in the StarterGui, by the way.
Here's my code:
local player = game.Players.LocalPlayer local mouse = player:GetMouse() local selection = Instance.new("SelectionBox",player.PlayerGui) selection.Color = BrickColor.new("Medium stone grey") repeat wait() until player.Character local character = player.Character local valid_target = character.valid_target local current_target = character.current_target mouse.Icon = "http://www.roblox.com/asset/?id=187412806" mouse.Move:connect(function() local target = mouse.Target if target ~= nil and current_target.Value ~= target.Parent 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=187412859" 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=187412830" 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=187412846" selection.Adornee = target.Parent valid_target.Value = true elseif hum and target.Parnet:IsA("Model") and player then mouse.Icon = "http://www.roblox.com/asset/?id=187412806" selection.Adornee = target.Parent valid_target.Value = true elseif not hum then mouse.Icon = "http://www.roblox.com/asset/?id=187412806" selection.Adornee = nil valid_target.Value = false end else mouse.Icon = "http://www.roblox.com/asset/?id=187412806" selection.Adornee = nil valid_target.Value = false end end)
Unsure why it wont work but I assume something hasn't loaded try placing some prints within your script to see how far the script gets before stopping that might give a hint as to why the problem is