The transparency part of this script is what isn't working. Does anyone know what is wrong with the gear script?
local Mouse = game.Players.LocalPlayer:GetMouse() local tool = script.Parent local Equipped = false tool.Equipped:Connect(function() Equipped = true end) tool.Unequipped:connect(function() Equipped = false end) Mouse.Button1Down:Connect(function(player) if Equipped then local Target = Mouse.Target Mouse.TargetFilter = game.Players.LocalPlayer.Character if Target.Name == "Dirt" then Target.Transparency = Target.Transparency - 0.1 end if Target.Transparency = 1 then Target:Destroy() local RE = game.ReplicatedStorage.RemoteEvent RE:FireServer(player) end end end)
This may or may not work
local Mouse = game.Players.LocalPlayer:GetMouse() local tool = script.Parent local Equipped = false tool.Equipped:Connect(function() Equipped = true end) tool.Unequipped:connect(function() Equipped = false end) Mouse.Button1Down:Connect(function(player) if Equipped then local Target = Mouse.Target Mouse.TargetFilter = game.Players.LocalPlayer.Character if Target.Name == "Dirt" then Target.Transparency -= 0.1 end if Target.Transparency == 1 then Target:Destroy() local RE = game.ReplicatedStorage.RemoteEvent RE:FireServer(player) end end end)
The problem is that you for an extra = for if Target.Transparency = 1 then
and an end)
Here's the edited code:
local Mouse = game.Players.LocalPlayer:GetMouse() local tool = script.Parent local Equipped = false tool.Equipped:Connect( function() Equipped = true end ) tool.Unequipped:connect( function() Equipped = false end ) Mouse.Button1Down:Connect( function(player) if Equipped then local Target = Mouse.Target Mouse.TargetFilter = game.Players.LocalPlayer.Character if Target.Name == "Dirt" then Target.Transparency = Target.Transparency - 0.1 end if Target.Transparency == 1 then Target:Destroy() local RE = game.ReplicatedStorage.RemoteEvent RE:FireServer(player) end end end )