Hey, I’m having some issues with this dash script.
Basically whats erroring is the render function, for some reason.
if anyone knows why, please let me know.
--// SERVICES
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local GuiService = game:GetService("GuiService")
local UserInputService = game:GetService("UserInputService")
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
--// VARIABLES
local DashFolder = ReplicatedStorage:WaitForChild("Dash")
local DashRemote = DashFolder:WaitForChild("Dash")
local Player = Players.LocalPlayer
--// FUNCTIONS
task.wait(5)
-->> Get Device
function GetDevice()
if GuiService:IsTenFootInterface() then
return "Console"
elseif UserInputService.TouchEnabled and not UserInputService.MouseEnabled then
return "Mobile"
else
return "Desktop"
end
end
-->> Activated
function Activated()
DashRemote:Fire()
end
script.Parent.Activated:Connect(Activated)
-->> Render
function Render()
local Device = GetDevice()
if Device == "Desktop" then
if Player then
if tonumber(Player:GetAttribute("Dash")) ~= nil then
if Player:GetAttribute("Dash") <= 0 then
script.Parent.Text = "Dash - " .. tostring(Player:GetAttribute("DashKey"))
else
script.Parent.Text = "Dash - " .. tostring(Player:GetAttribute("Dash")) .. "s"
end
end
end
end
end
RunService.RenderStepped:Connect(Render)
Thank you.