You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? I am trying to change the cursor when a tool is equipped.
What is the issue? The cursor remains the same.
What solutions have you tried so far? Currently, the tools are being issued to players from the server when they join, since a datastore must first determine if they own each weapon. When they equip these weapons everything works fine except that the cursor does not change. When I tried just placing the tools in StarterPack, the code worked and the cursor changed correctly.
--#Palmtreeninja2
wait(2)
--#Variables
local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild("Humanoid")
local Mouse = Player:GetMouse()
local Gun = script.Parent.Parent
local BulletOrigin = Gun:WaitForChild("BulletOrigin")
local AnimationFolder = Gun:WaitForChild("Animations")
--#Animations
local Draw = AnimationFolder:WaitForChild("Draw")
local Idle = AnimationFolder:WaitForChild("Idle")
local Aim = AnimationFolder:WaitForChild("Aim")
local Fire = AnimationFolder:WaitForChild("Fire")
local Reload = AnimationFolder:WaitForChild("Reload")
local Quickshot = AnimationFolder:WaitForChild("Quickshot")
local Holster = AnimationFolder:WaitForChild("Holster")
local DrawAnimation = Humanoid:LoadAnimation(Draw)
local HolsterAnimation = Humanoid:LoadAnimation(Holster)
local IdleAnimation = Humanoid:LoadAnimation(Idle)
local AimAnimation = Humanoid:LoadAnimation(Aim)
local FireAnimation = Humanoid:LoadAnimation(Fire)
local QuickshotAnimation = Humanoid:LoadAnimation(Quickshot)
local ReloadAnimation = Humanoid:LoadAnimation(Reload)
--#Services
local UIS = game:GetService("UserInputService")
local FireKey = Enum.UserInputType.MouseButton1
--#Values
local Equipped = false
local Aiming = false
local Recoiling = false
local RecoilTime = 0.2
local Reloading = false
local BulletsCapacity = 50
--#Events
local EventsFolder = Gun:WaitForChild("Events")
local CockedEvent = EventsFolder:WaitForChild("Cocked")
local ShotEvent = EventsFolder:WaitForChild("Shot")
local ReloadedEvent = EventsFolder:WaitForChild("Reloaded")
local EquippedEvent = EventsFolder:WaitForChild("Equipped")
local HolsteredEvent = EventsFolder:WaitForChild("Holstered")
local CreateBulletEvent = game.ReplicatedStorage.ShotFired
--#UI
local HUD = Gun.HUD:Clone()
--#Functions
local function reload()
if Equipped then
Reloading = true
script.Parent.Parent.Sounds.Reload:Play()
ReloadAnimation:Play()
ReloadAnimation.Stopped:Wait()
BulletsCapacity = 50
HUD.Ammo.Amount.Text = "50 / 50"
Reloading = false
end
end
local function Equip()
Equipped = true
Aiming = true
game.Players.LocalPlayer:GetMouse().Icon = script.Parent.Parent.ZipgunRhetical.Texture
print(Mouse.Icon)
EquippedEvent:FireServer()
CockedEvent:FireServer()
HUD.Parent = Player.PlayerGui
Player.CameraMinZoomDistance = 0.5
Player.CameraMaxZoomDistance = 0.5
Character.GunBelt.Dashes.Transparency = 1
Character.GunBelt.Frame.Transparency = 1
Character.GunBelt.Magazine.Transparency = 1
Character.GunBelt.Slide.Transparency = 1
Character.GunBelt.Trigger.Transparency = 1
Humanoid.CameraOffset = Vector3.new(0,0,-1)
DrawAnimation:Play()
DrawAnimation.Stopped:Wait()
AimAnimation:Play()
end
local function UnEquip()
Equipped = false
game.Players.LocalPlayer:GetMouse().Icon = ""
HolsteredEvent:FireServer()
HUD.Parent = Gun
Player.CameraMinZoomDistance = 0.5
Player.CameraMaxZoomDistance = 30
Character.GunBelt.Dashes.Transparency = 0
Character.GunBelt.Frame.Transparency = 0
Character.GunBelt.Magazine.Transparency = 0
Character.GunBelt.Slide.Transparency = 0
Character.GunBelt.Trigger.Transparency = 0
Humanoid.CameraOffset = Vector3.new(0,0,0)
AimAnimation:Stop()
HolsterAnimation:Play()
Humanoid.WalkSpeed = game.StarterPlayer.CharacterWalkSpeed
end
local function Shoot()
if Equipped and not Recoiling and not Reloading and BulletsCapacity >= 1 then
local Target = Mouse.Hit.p
if Aiming then
BulletsCapacity -= 1
ShotEvent:FireServer()
Recoiling = true
FireAnimation:Play()
CreateBulletEvent:FireServer(Target,BulletOrigin.Position)
workspace.CurrentCamera.CFrame = workspace.CurrentCamera.CFrame * CFrame.Angles(math.rad(.5),0,0)
wait(RecoilTime)
Recoiling = false
HUD.Ammo.Amount.Text = BulletsCapacity .. " / 50"
end
end
end
--#Run
Gun.Equipped:Connect(Equip)
Gun.Unequipped:Connect(UnEquip)
UIS.InputBegan:Connect(function(input,chatting)
if not chatting and input.UserInputType == FireKey then
Shoot()
end
if not chatting and input.KeyCode == Enum.KeyCode.R then
reload()
end
end)
UIS.InputEnded:Connect(function(input,chatting)
if not chatting and input.UserInputType == FireKey then
Shoot()
end
end)
Humanoid.Died:Connect(UnEquip)
Everything else is working fine. It’s just like the script is skipping over the line about the mouse icon. I’ve also noticed that it works in studio, but not in the game.
The tool doesn’t know on which to follow, when the part is now visible? or when the tool has been used. So when you create a tool it enables RequiresHandle already. So the equipped/unequiped/active function will run once the part is visible (if RequiresHandle exist) if there’s no part named “handle” its clueless if it’s equipped.
Video Explanation Notes: The first tool is the tool where the RequiresHandle is enabled The second tool is the tool where the RequiresHandle is disabled
Bro I’m not trying to sound rude, but you are on a completely different subject. The tool works fine. The gun fires, reloads, equips, and unequips, has a handle, does all the right sounds, animations, effects, etc… I’m just talking about the cursor.
are you sure that id exists.(sorry ik i should cheeck myseelf but im not in studio so i asked.).
Try putting the id in a image label and if it changes to ur deesired imagee then its some other problem else check your string.
The images appear when I test in studio. After it worked in studio I updated the game and went to play it on the actual roblox page, but it didnt work.
I made the icons more than a month ago. They are fully approved. I just hadn’t tested the game on actual Roblox until now. I swapped it out with other ids and they also didnt show up.
Try printing the mouse.its possible that the mouse isnt detected. If it does then make sure that your string for asset id is correct(which is very less likely).