Hey, I've been trying to learn how to script in Roblox Lua, which is by no means Python. It's rather hard to learn and I've been reading documentation and examples but whenever I find something, it ends up not working no matter what even if I follow the example step-by-step, or it ends up only covering how to name and write variables and other very simple tasks, or it involves branches that just don't exist anymore, i.e. Local.Player.
Can anyone give me up-to-date guides of the library? api.roblox is outdated and so is the wiki. Very stuck right now. Also while Lua is basically C with alterations since it's a C extension, I can't use most of my C knowledge, which is very limited, to use with Roblox.
To be more technical, I'll explain exactly what I was trying to do.
First, I tried making a leveling UI with support for a future perk system.
game.Players.PlayerAdded:Connect(function(Player) local Data = Instance.new(intvalue,Player) Data.Name = 'Data' local XP = instance.new(intvalue,Data) local PerkPoint = Instance.new(intvalue,Data) PerkPoint.Name = 'Perk Point' XP.name = 'Experience' local Level = instance.new(intvalue,Data) Level.Value = 1 XP.Changed:Connect(function()XPChangingFunction(Player.XP,Level,PerkPoint)end) end) function XPChangingFunction(Player,XP,Level) if XP.Value (GREATER THAN) Level.Value * 150 then XP.Value = 0 Level.Value = Level.Value + 1 PerkPoint.Value = PerkPoint + 1 end end
is the first script. It's supposed to create a Data directory in the local player, but it doesn't.
Then I have a GUI with a script that goes like this:
>while true do wait() local XP = script.Parent.Parent.Parent.Parent.Parent.Data.Level.Value local MaxXP = script.Parent.Parent.Parent.Parent.Parent.Data.Level.Value * 150 local Mathematics = (XP / MaxXP) script.Parent:TweenSize(UDIm2.new(Mathematics,0,1,0),'Out','Quad',25) end>
And I have a sneak script that goes way different and tries to implement sneak. I tried to post it here but character limit said no.
What am I doing wrong?
I also tried my luck earlier with keypress and timers to make it so spamming (not holding) f would make the player gradually run faster, as a unique and skill-oriented approach to sprinting, but it didn't work so I scrapped it.