I’ve been working on a piece of code that teleports you when you click, more specifically the GUI that displays the cooldown.
The error that I keep receiving is " attempt to index string with ‘TextTransparency’ ".
And i do not know how to fix it.
Full script:
local char = script.Parent
local humanoid = char.HumanoidRootPart
local player = game:GetService("Players").LocalPlayer
local debounce = true
local mouse = player:GetMouse()
mouse.Button1Down:Connect(function()
local position = mouse.Hit.Position
local function FireServer()
game:GetService("ReplicatedStorage").ClickToTeleportEvent:FireServer(position)
end
if debounce == true then
debounce = false
FireServer()
player.PlayerGui.ClickToTeleportGui.TextLabel.Text.TextTransparency = true
player.PlayerGui.ClickToTeleportGui.TextLabel.Text.BackgroundTransparency =
true
player.PlayerGui.ClickToTeleportGui.TextLabel.Text = "CoolDown: 2"
wait(1)
player.PlayerGui.ClickToTeleportGui.TextLabel.Text = "CoolDown: 1"
wait(1)
player.PlayerGui.ClickToTeleportGui.TextLabel.Text = "CoolDown: 0"
wait(1)
player.PlayerGui.ClickToTeleportGui.TextLabel.Text.TextTransparency = false
player.PlayerGui.ClickToTeleportGui.TextLabel.Text.BackgroundTransparency =
false
player.PlayerGui.ClickToTeleportGui.TextLabel.Text = "CoolDown: 2"
debounce = true
end
end)