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

I have a problem with my script it shows an error but I dont know why it shows it when I change it?

Asked by
WN0820 11
4 years ago

So someone helped me fix a script but when I tested it the error said

14:56:05.206 - PunchPower is not a valid member of Stats 14:56:05.211 - Stack Begin 14:56:05.213 - Script 'Workspace.Size?', Line 2 14:56:05.215 - Stack End

he made it that it is leaderstats but I have stats heres the script but it is with the leaderstats

local plr = script.Parent.Parent local Punch = plr:WaitForChild("leaderstats").PunchPower

if plr.Punch.Value == 100 and 100000 then local FireBallSize = Vector3.new(2.19,2.19,2.19) game.ServerScriptService.FireBallServer.FireBall.Size = FireBallSize end

if plr.Punch.Value == 1000000 or 10000000 then local FireBallSize = Vector3.new(10.19,10.19,10.19) game.ServerScriptService.FireBallServer.FireBall.Size = FireBallSize end

I dont know why it doesnt work my leaderstats are in serverscriptservice called Leaderstats and under it is the value PunchPower and it is Stats not leaderstats so if you can fix it Thanks heres the script for leaderstats if you need have a look at it but I want fix the script up ahead

game.Players.PlayerAdded:connect(function(player) local DataStore = game:GetService("DataStoreService")

 local leader = Instance.new("Folder",player)

leader.Name = "Stats"

for i,v in pairs(script:GetChildren()) do local d = DataStore:GetDataStore(v.Name) local x = Instance.new("NumberValue",leader) x.Name = v.Name x.Value = d:GetAsync(player.UserId) or v.Value

end end)

game.Players.PlayerRemoving:Connect(function(player) for i,v in pairs(script:GetChildren()) do print("Getting") local DataStore = game:GetService("DataStoreService") local d = DataStore:GetDataStore(v.Name) d:SetAsync(player.UserId, player.Stats[v.Name].Value) print("Saved") end end)

this works but if you need know what leader.Name has it then ye Thanks again if you can fix it

0
You may want to put all the code in code blocks so it's easier to look at. SteelMettle1 394 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

"PunchPower" is just not the child of "Stats".

0
gamer move MythsList 38 — 4y
0
not really WN0820 11 — 4y
Ad

Answer this question