#why my model have cooldown?
1 messages · Page 1 of 1 (latest)
Bro you are doing WAY to much just to make a ScreenGui. Like i would understand it if other players could see your BillboardGui but there is really no reason to try to mimic a ScreenGui.
nah it's kinda messy tbh. you're calling GetState in a weird way with hum.GetState(hum) instead of just hum:GetState(). also hum can be nil because you use FindFirstChildOfClass("Humanoid") and then instantly access hum.MoveDirection without checking if it actually exists. you're also calling workspace.CurrentCamera a bunch of times instead of just storing it in a local variable, and the same thing with os.clock() since you're recalculating it multiple times in the same frame for the sin/cos stuff.
another thing is that Ray.new doesn't actually perform a raycast, it only creates the ray object, so that part of the code is kinda outdated since most people just use workspace:Raycast() now. plus doing FindFirstChildOfClass every update isn't great either, normally you'd cache the humanoid when the character loads instead of searching for it every frame. it also assumes LocalPlayer.Character always exists which can break when the character respawns.
so it's not like it won't work, but it's kinda old style and not really optimized.
Code bad = bad results