local UIS = game:GetService("UserInputService")
local Cooldown = false
local CooldownDuration = 0
local DropLava = game:GetService("ReplicatedStorage"):WaitForChild("DropLava")
local plr = game.Players.LocalPlayer
local function AddHighlight()
local LavaStorage = workspace:WaitForChild("LavaStorage"):GetChildren()
for _, Lava in pairs(LavaStorage) do
if Lava.Owner.Value == plr.Name then
local Highlight = Instance.new("Highlight")
Highlight.Parent = Lava
Highlight.FillTransparency = 1
end
end
end
UIS.InputBegan:Connect(function(input, gameProcessedEvent)
if not gameProcessedEvent then
if input.UserInputType == Enum.UserInputType.MouseButton1 then
if Cooldown == false then
DropLava:FireServer()
AddHighlight()
Cooldown = true
task.wait(CooldownDuration)
Cooldown = false
end
end
end
end)
For some reason when i click it once it wont parent i need to click it another time