Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Cannot check OR change any player stats through a localscript [FE]?

Asked by 6 years ago
Edited 6 years ago

** This is my first time using filtering enabled, so I may have made some mistakes here and there. **

I've been working recently on one of my projects, and everything has been going smoothly until I decided to start working on a shop, to buy stuff with in-game currency. I started to try and change values, and it just refuses to work. I have no idea how to fix this, and I've been stuck on this for maybe a couple days already. Can anyone tell me how to improvise, or fix this error?

--[Variables]--


local player = game.Players.LocalPlayer
local character = player.Character
local humanoid = character:WaitForChild'Humanoid'
local FormEvent = game:GetService('ReplicatedStorage'):WaitForChild('Remotes'):WaitForChild'Form'


--This is where it errors.
local data = player:WaitForChild('data')
local inform = data:FindFirstChild'inform'


local lleg = character:WaitForChild'LeftLowerLeg'
local rleg =character:WaitForChild'RightLowerLeg'
local lt = character:WaitForChild'LowerTorso'
local larm = character:WaitForChild'LeftLowerArm'
local rarm = character:WaitForChild'RightLowerArm'
local inputserver = game:GetService('UserInputService')

inputserver.InputBegan:connect(function(input, gameProcessedEvent)
    if input.KeyCode == Enum.KeyCode.H and humanoid.Health > 20 and player and player.Character  and player:FindFirstChild'uiomentag'.Value == true  and inform.Value == false then
        FormEvent:FireServer(player, 'UltraInstinctOmen', 'TransForm')

    end
end)

Here is another piece of code that just refuses to work:

local player = game.Players.LocalPlayer
local character = player.Character

--Here is where it errors.
local data = player:WaitForChild'data'
local zeni = data:FindFirstChild'zeni'



local banner = script.Parent.Parent
local remote = game:GetService('ReplicatedStorage'):WaitForChild('Remotes'):WaitForChild'Learn'

script.Parent.MouseButton1Click:Connect(function()
    if zeni.Value >= 300000 then
    banner:Destroy()
    remote:FireServer(player, 'Lower', 'Zeni', 300000)
    end
end)


Answer this question