This script keeps working in studio, but not in game. I check in game each time and im getting errors about mouse.target being nil but i keep trying to add fail safes to make sure that the thing only works when mouse.target isnt nil. The script is supposed to display a billboardgui on a part named "Detect" when it is mouse.target.
script:
i = false
game.Players.PlayerAdded:connect(function(plr)
lead = Instance.new('Model', plr)
lead.Name = "leaderstats"
log = Instance.new('NumberValue', lead)
log.Name = "Log Count"
mouse = plr:GetMouse()
plr.CharacterAdded:connect(function(chr)
repeat
wait()
if plr:GetMouse().target ~= nil then
if plr:GetMouse().target.Name == "Detect" then
if plr:GetMouse().target.Value.Value == true then
if mouse.target:FindFirstChild('CollectGui') then
--
else
magnitude = (plr:GetMouse().target.Position - chr.Torso.Position).magnitude
print(magnitude)
if magnitude < (Vector3.new(10, 10, 10) - Vector3.new(0, 0, 0)).magnitude then
local gui = game.Lighting.CollectGui:Clone()
gui.Parent = plr:GetMouse().target
end
end
wait()
end
end
end
until i == true
end)
end)
place: https://www.roblox.com/games/557858400/MrDefaultMans-Place-Number-93

1 comment
thanks ill try to see what i can do (when im not too tired to script anymore)