For some reason, I am not able to change a mouse cursor’s texture to the default one (Yes I’ve tried: “http://www.roblox.com/asset?id=” and it still doesn’t work). This happens after I change the cursor previously and then try changing it back to the default one, does anybody happen to know the file name of the default cursor? (For example: “rbxasset://textures\GunCursor.png” “GunCursor.png” is the cursor’s name, I’ve tried “Cursor” and “DefaultCursor”).
That seems surprisingly odd…
That should usually work.
Here are some Solutions:
Copy the file, and use it.
Resetting Studio.
Hope that helps!
You can actually just do
Mouse.Icon = [[ ]] --Weird formatting cuz I’m on my phone.
And it will reset to default. Just make it an empty string.
In normal string definition that is Mouse.Icon = ""
If you give it a full asset URL (without the numbers) it’ll end up thinking you’re trying to give it something. To show the default cursor, you have to make it clear that you aren’t linking to a custom one, and that is what the empty string is for.
I thought an empty string made it have no image at all?
Nope. As @EmeraldSlash explained, an empty string basically tells it to stop using any custom cursor icon.
You need to fix the slash like this:
rbxasset://textures/GunCursor.png
If you put rbxasset://textures\GunCursor.png
in the Properties window, Studio will auto-fix it to the right slash direction for you, but this doesn’t happen if you set the texture programmatically.
If you want the default cursor (for use outside of just Mouse.Icon
) you can use rbxasset://textures/ArrowFarCursor.png
, rbxasset://textures/ArrowCursor.png
, or even rbxasset://textures/advCursor-white.png
(plus rbxasset://textures/MouseLockedCursor.png
if you want to have the locked mouse cursor).
I hope this helps
Quick edit: I found the files in my AppData/Local/Roblox/Versions folder
I also didn’t realize that this post was from so long ago
btw is there a glitch in roblox studio becuz i tried changing the cursor with script but its not loading here it is :
and also it dont return back to normal when using empty string
local plr = game.Players.LocalPlayer
local humanoid = plr.Character.Humanoid
local run = game:GetService("RunService")
local cam = workspace.CurrentCamera
local souns = Instance.new("Sound")
souns.Parent = script
souns.Name = "Shooted"
souns.SoundId = "rbxassetid://560908171"
local relodSound = Instance.new("Sound")
relodSound.Parent = script
relodSound.SoundId = "rbxassetid://3606136833"
relodSound.Name = "reloadsoun"
local aiming = false
local aimcf = CFrame.new()
local gun = game.ReplicatedStorage.Weapons.glockarm:Clone()
local s = require(game.ReplicatedStorage.WeaponsModules:WaitForChild("Glock18"))
gun:SetPrimaryPartCFrame(cam.CFrame)
run.RenderStepped:Connect(function()
gun:SetPrimaryPartCFrame(cam.CFrame
*s.weaponpos
*aimcf
)
if aiming then
aimcf = aimcf:Lerp(s.AimCFrame, 0.1)
else
aimcf = aimcf:Lerp(CFrame.new(), 0.1)
end
end)
gun.Parent = cam
local idle = gun.Humanoid:LoadAnimation(game.ReplicatedStorage.WeaponsModules.Glock18.Anim.idle)
idle:Play()
local shoot = gun.Humanoid:LoadAnimation(game.ReplicatedStorage.WeaponsModules.Glock18.Anim.shoot)
local Mouse = plr:GetMouse()
Mouse.Icon ="http://www.roblox.com/asset?id=57571496"
Mouse.Button1Down:Connect(function()
shoot:play()
souns:Play()
Mouse.Button2Down:connect(function()
aiming = true
end)
Mouse.Button2Up:connect(function()
aiming = false
end)
game:GetService("UserInputService").InputBegan:Connect(function(input, Game)
if Game == true then return end
if input.KeyCode == Enum.KeyCode.R then
local reload = gun.Humanoid:LoadAnimation(game.ReplicatedStorage.WeaponsModules.Glock18.Anim.reload)
reload:Play()
relodSound:play()
end
end)
end)
plr.CameraMode = Enum.CameraMode.LockFirstPerson
local function onDied()
gun.Parent.Parent = nil;
souns:Remove()
relodSound:Remove()
plr.CameraMode = Enum.CameraMode.Classic
Mouse.Icon =""
end
local function onUpdate(dt)
gun:SetPrimaryPartCFrame(cam.CFrame)
Mouse.Icon ="http://www.roblox.com/asset?id=57571496"
end
humanoid.Died:Connect(onDied);
run.RenderStepped:connect(onUpdate)
gun:SetPrimaryPartCFrame(cam.CFrame*s.weaponpos)
I can see that you accidentally wrote the asset ID incorrectly. You forgot about the “/” after asset in “http://www.roblox.com/asset/?=”
What I do suggest is replacing the old asset format with the new one here:
Mouse.Icon = "rbxassetid://[ID]"
It will save you time writing “http://www.roblox.com/asset/?=” over and over for the future
I fixed it up for you right here
local plr = game.Players.LocalPlayer
local humanoid = plr.Character.Humanoid
local run = game:GetService("RunService")
local cam = workspace.CurrentCamera
local souns = Instance.new("Sound")
souns.Parent = script
souns.Name = "Shooted"
souns.SoundId = "rbxassetid://560908171"
local relodSound = Instance.new("Sound")
relodSound.Parent = script
relodSound.SoundId = "rbxassetid://3606136833"
relodSound.Name = "reloadsoun"
local aiming = false
local aimcf = CFrame.new()
local gun = game.ReplicatedStorage.Weapons.glockarm:Clone()
local s = require(game.ReplicatedStorage.WeaponsModules:WaitForChild("Glock18"))
gun:SetPrimaryPartCFrame(cam.CFrame)
run.RenderStepped:Connect(function()
gun:SetPrimaryPartCFrame(cam.CFrame
*s.weaponpos
*aimcf
)
if aiming then
aimcf = aimcf:Lerp(s.AimCFrame, 0.1)
else
aimcf = aimcf:Lerp(CFrame.new(), 0.1)
end
end)
gun.Parent = cam
local idle = gun.Humanoid:LoadAnimation(game.ReplicatedStorage.WeaponsModules.Glock18.Anim.idle)
idle:Play()
local shoot = gun.Humanoid:LoadAnimation(game.ReplicatedStorage.WeaponsModules.Glock18.Anim.shoot)
local Mouse = plr:GetMouse()
Mouse.Icon = "rbxassetid://57571496"
Mouse.Button1Down:Connect(function()
shoot:play()
souns:Play()
Mouse.Button2Down:connect(function()
aiming = true
end)
Mouse.Button2Up:connect(function()
aiming = false
end)
game:GetService("UserInputService").InputBegan:Connect(function(input, Game)
if Game == true then return end
if input.KeyCode == Enum.KeyCode.R then
local reload = gun.Humanoid:LoadAnimation(game.ReplicatedStorage.WeaponsModules.Glock18.Anim.reload)
reload:Play()
relodSound:play()
end
end)
end)
plr.CameraMode = Enum.CameraMode.LockFirstPerson
local function onDied()
gun.Parent.Parent = nil;
souns:Remove()
relodSound:Remove()
plr.CameraMode = Enum.CameraMode.Classic
Mouse.Icon = ""
end
local function onUpdate(dt)
gun:SetPrimaryPartCFrame(cam.CFrame)
Mouse.Icon = "rbxassetid://57571496"
end
humanoid.Died:Connect(onDied);
run.RenderStepped:connect(onUpdate)
gun:SetPrimaryPartCFrame(cam.CFrame*s.weaponpos)
oh thanks a lot man for this
You can access the default mouse icon via the files.
To apply the default mouse, use the following code lines:
local Players= = game:GetService("Players")
local Player = Players.LocalPlayer
local Mouse = Player:GetMouse()
Mouse.Icon = "rbxasset://textures/Cursors/KeyboardMouse/ArrowFarCursor.png"
You can also get the default cursor by doing;
local Players = game:GetService("Players")
local Player = Players.LocalPlayer
local Mouse = Player:GetMouse()
Mouse.Icon = ""
Unless you want to use a different cursor from the Roblox files; this is how you can set it to default without having to type in "rbxasset://textures/Cursors/KeyboardMouse/ArrowFarCursor.png"
every time you need to change it to default. Just a small tip if you want it to be easier (or if the default cursor changes again for some reason).
And you have tested this and made sure it works?
Yes, I have. It’s something I have used in multiple scripts without any issues. One thing I know is that setting Mouse.Icon
to nil
will result in an error, but setting it to ""
will not as it will return the cursor back to the default state. It will revert all cursor changes back to the default cursor Roblox has set. It shows on the DevForum.
Alright, didn’t know that. lol
Ey, no problem with telling ya about it. Nothing wrong with learning something new every so often
You could Store the default cursor in a variable before changing it
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local HitCursor = 'http://www.roblox.com/asset?id=123456789'
local defaultCursor = mouse.Icon
hit.OnClientEvent:Connect(function(target)
mouse.Icon = HitCursor --change cursor
wait(0.1)
mouse.Icon = defaultCursor --revert back to default one
end)