generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
We use cookies to offer you a better experience. By using Roblox.com, you are agreeing to our Privacy and Cookie Policy.
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Creating HitMarker

Previous Thread :: Next Thread 
someonedie is not online. someonedie
Joined: 19 Mar 2011
Total Posts: 1710
20 Sep 2015 10:36 AM
How would I do that exactly? I found that changing the mouse icon and going back instantly doesn't help to well and breaks it. What should I do?

--
damage=100

debris=game:GetService("Debris")
local HitMarker = "http://www.roblox.com/asset/?id=176124496"
local player = game.Players.LocalPlayer
local Mouse = player:GetMouse()

local h=hit.Parent:FindFirstChild("Humanoid")

if h.Health > damage then
local currentPic = Mouse.Icon
Mouse.Icon = HitMarker
local HitSound = script.HitSound:Clone()
HitSound.Parent = player.PlayerGui
HitSound:Play()
delay(0.05, function() Mouse.Icon = currentPic HitSound:Destroy() end)
end
Report Abuse
SenseiWarrior is online. SenseiWarrior
Joined: 09 Apr 2011
Total Posts: 12140
20 Sep 2015 10:36 AM
guis


#code return
Report Abuse
someonedie is not online. someonedie
Joined: 19 Mar 2011
Total Posts: 1710
20 Sep 2015 10:37 AM
How would I keep the gui positioned on that mouse?
Report Abuse
someonedie is not online. someonedie
Joined: 19 Mar 2011
Total Posts: 1710
20 Sep 2015 10:40 AM
Bump.
Report Abuse
Posuceius is not online. Posuceius
Joined: 07 Apr 2010
Total Posts: 267
20 Sep 2015 10:42 AM
mouse.Icon = "rbxasset"

just make it change the icon of the mouse whenever you deal damage to a player
Report Abuse
someonedie is not online. someonedie
Joined: 19 Mar 2011
Total Posts: 1710
20 Sep 2015 11:16 AM
I do that but it no work for some reason.
Report Abuse
Posuceius is not online. Posuceius
Joined: 07 Apr 2010
Total Posts: 267
20 Sep 2015 11:19 AM
I'm not too savvy at Lua myself, but from what I can see I believe the problem lies in your "local Mouse = player:GetMouse()"


Perhaps try removing that and then changing your "Mouse.Icon = HitMarker" to "mouse.Icon = HitMarker", since mouse is already a variable in ROBLOX.
Report Abuse
morashsPeasant is not online. morashsPeasant
Joined: 06 Jan 2011
Total Posts: 4944
20 Sep 2015 11:28 AM
You'd create a gui that is positioned right where the mouse is. To center this hitmarker gui to the center of the mouse you'd go

local mouse = game.Players.LocalPlayer:GetMouse()
hitMarker.Position = UDim2.new(0,mouse.Position.X - hitMarker.Size.X.Offset/2,0,mouse.Position.Y - hitMarker.Size.Y.Offset/2)

something like that.. you subtract the half of the size so its exactly in the center :D
Report Abuse
RektHelm is not online. RektHelm
Joined: 25 Aug 2012
Total Posts: 899
20 Sep 2015 12:11 PM
What I use.
local humanoids = {}
local hm = script.Hitmarker

function iterate(p)
print("Finding humanoids....")
for i,v in pairs(p:GetChildren()) do
if v:IsA("Humanoid") and not humanoids[v] then
humanoids[v] = true
print("Found a humanoid in " .. v.Parent.Name .. ".")
end
if #v:GetChildren() > 0 then
wait()
iterate(v)
end
end
end

function FadeOut(g)
for i,v in pairs(g:GetChildren()) do
coroutine.resume(coroutine.create(function()
local x = v
for i = 0, 1, .1 do
x.BackgroundTransparency = i
wait()
end
x:Destroy()
end))
end
repeat wait() until #g:GetChildren() == 0
g:Destroy()
end

function Connect()
for i,v in pairs(humanoids) do
i.ChildAdded:connect(function(c)
if c.Name == "creator" then
print("Creator added!")
local player = c.Value
if player then
local h = hm:Clone()
h.Parent = player.PlayerGui
wait(.5)
coroutine.resume(coroutine.create(function()
FadeOut(h)
end))
end
end
end)
end
end

local b = tick()
iterate(Workspace)
print("Time taken to get humanoids: " .. tick()-b)

for i,v in pairs(humanoids) do
print(i)
end

Connect()

do
Game.Players.PlayerAdded:wait()
iterate(Workspace)
Connect()
end
Report Abuse
Immacularity is not online. Immacularity
Joined: 21 Jun 2014
Total Posts: 419
20 Sep 2015 12:13 PM
"mouse is already a variable in roblox"
what
when


http://www.roblox.com/--item?id=130759239
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image