Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How can I refer to decals in scripting?

Asked by 7 years ago

I made a gun crosshair and uploaded it to roblox as a decal. I got a free model that changed the player's cursor to a crosshair. I'm tried to replace the normal cursor to this cursor (https://www.roblox.com/library/1360402244/Magnum-Recticle-Normal) by changing the number in the asset id but it is not working. How can I change the original crosshair in the script below to the one I made in the link above?

Heres the free model script that worked fine

bin = script.Parent
normel = "http://www.roblox.com/asset/?id=7419350"
friendly = "http://www.roblox.com/asset/?id=7419364"
enemy = "http://www.roblox.com/asset/?id=7419379"
function Run(mouse)
    mouse.Icon = normel
    local hit = mouse.Target
    if (hit == nil) then return end
        h = hit.Parent:FindFirstChild("Humanoid")
        if h ~= nil then
        torso = hit.Parent.Torso
        if torso ~= nil then
        if h.Health > 0 then
    if (torso.BrickColor == bin.Parent.Torso.BrickColor) then
        mouse.Icon = friendly
        elseif torso.BrickColor ~= bin.Parent.Torso.BrickColor then
        mouse.Icon = enemy
        end
        end
        end

    end
end

1 answer

Log in to vote
1
Answered by 7 years ago
Edited 7 years ago

Hi,

You can replace the Cursor IDs shown in the script with your Texture ID.

Go to your image, you should have this option below it called: "Content". You will see that it pops up a button that you can click called: "Image", click it.

It will pop up a new tab for you with the exact texture of the decal.

Now, look at the link URL, you should see numbers in the link after /library/.

Copy the numbers and paste them into the script after ?id= (make sure that the numbers beforehand are removed and that it is still in the " ".

It should be like this:

bin = script.Parent
normel = "http://www.roblox.com/asset/?id=1360402243"
friendly = "http://www.roblox.com/asset/?id=1360402243"
enemy = "http://www.roblox.com/asset/?id=1360402243"
function Run(mouse)
    mouse.Icon = normel
    local hit = mouse.Target
    if (hit == nil) then return end
        h = hit.Parent:FindFirstChild("Humanoid")
        if h ~= nil then
        torso = hit.Parent.Torso
        if torso ~= nil then
        if h.Health > 0 then
    if (torso.BrickColor == bin.Parent.Torso.BrickColor) then
        mouse.Icon = friendly
        elseif torso.BrickColor ~= bin.Parent.Torso.BrickColor then
        mouse.Icon = enemy
        end
        end
        end

    end
end

Note: If you have any problems or troubles, please comment.

Sincerely, Arti_BLOX.

0
I don't see content anywhere. Please help! I even did Ctrl-F to find it but nothing was there! Below the image was the 'favourite' star, recommended items and the comments section. dadysherwin2 155 — 7y
0
Nvm I found out a different way, I searched up in roblox wiki 'Texture ID'. But thanks soooo much! Without your help I wouldn't have been able to find out how to do it cause you said in your answer 'You can replace the Cursor IDs shown in the script with your Texture ID.' Thanks soo much dude! dadysherwin2 155 — 7y
0
No problem man! Arti_BLOX 58 — 6y
Ad

Answer this question