I am working on an Anime game, and we have forms such as Super Saiyan, and when you leave in a form you keep the stats without the transformation. That is what the following script is meant to do, take the forms stats off and then save the normal base stats. But it doesn't work, and returns no errors in the output, please help.

Script:

local DS = game:GetService("DataStoreService"):GetDataStore("DBZSCSaveWiped")
game.Players.PlayerRemoving:Connect(function(Player)
	local Char = workspace:FindFirstChild(Player.Name)
		local Arg = Char.KeyPressScripts.WhatForm.Value
		if Arg == "FSSJ" then
			Player.Statistics.Melee.Value = Player.Statistics.Melee.Value - 25
			Player.Statistics.Speed.Value = Player.Statistics.Speed.Value - 25
			Player.Statistics.FlyingSpeed.Value = Player.Statistics.FlyingSpeed.Value - 25
			wait(2)
			DS:SetAsync("id_"..Player.userId, {Player.Statistics.Level.Value, Player.Statistics.Melee.Value, Player.Statistics.Exp.Value, Player.Statistics.FlyingSpeed.Value, Player.Statistics.Health.Value, Player.Statistics.Speed.Value, Player.Statistics.SSJ1.Value, Player.Statistics.SSJG.Value, Player.Statistics.Zeni.Value, Player.Statistics.FSSJ.Value, Player.Statistics.SSJB.Value})
			wait(5)
		elseif Arg == "SSJ1" then
			Player.Statistics.Melee.Value = Player.Statistics.Melee.Value - 50
			Player.Statistics.Speed.Value = Player.Statistics.Speed.Value - 50
			Player.Statistics.FlyingSpeed.Value = Player.Statistics.FlyingSpeed.Value - 50
			wait(2)
			DS:SetAsync("id_"..Player.userId, {Player.Statistics.Level.Value, Player.Statistics.Melee.Value, Player.Statistics.Exp.Value, Player.Statistics.FlyingSpeed.Value, Player.Statistics.Health.Value, Player.Statistics.Speed.Value, Player.Statistics.SSJ1.Value, Player.Statistics.SSJG.Value, Player.Statistics.Zeni.Value, Player.Statistics.FSSJ.Value, Player.Statistics.SSJB.Value})
			wait(5)
		elseif Arg == "SSJG" then
			Player.Statistics.Melee.Value = Player.Statistics.Melee.Value - 200
			Player.Statistics.Speed.Value = Player.Statistics.Speed.Value - 200
			Player.Statistics.FlyingSpeed.Value = Player.Statistics.FlyingSpeed.Value - 200
			wait(2)
			DS:SetAsync("id_"..Player.userId, {Player.Statistics.Level.Value, Player.Statistics.Melee.Value, Player.Statistics.Exp.Value, Player.Statistics.FlyingSpeed.Value, Player.Statistics.Health.Value, Player.Statistics.Speed.Value, Player.Statistics.SSJ1.Value, Player.Statistics.SSJG.Value, Player.Statistics.Zeni.Value, Player.Statistics.FSSJ.Value, Player.Statistics.SSJB.Value})
			wait(5)
		elseif Arg == "SSJB" then
			Player.Statistics.Melee.Value = Player.Statistics.Melee.Value - 500
			Player.Statistics.Speed.Value = Player.Statistics.Speed.Value - 500
			Player.Statistics.FlyingSpeed.Value = Player.Statistics.FlyingSpeed.Value - 500
			wait(2)
			DS:SetAsync("id_"..Player.userId, {Player.Statistics.Level.Value, Player.Statistics.Melee.Value, Player.Statistics.Exp.Value, Player.Statistics.FlyingSpeed.Value, Player.Statistics.Health.Value, Player.Statistics.Speed.Value, Player.Statistics.SSJ1.Value, Player.Statistics.SSJG.Value, Player.Statistics.Zeni.Value, Player.Statistics.FSSJ.Value, Player.Statistics.SSJB.Value})
			wait(5)
		end
	DS:SetAsync("id_"..Player.userId, {Player.Statistics.Level.Value, Player.Statistics.Melee.Value, Player.Statistics.Exp.Value, Player.Statistics.FlyingSpeed.Value, Player.Statistics.Health.Value, Player.Statistics.Speed.Value, Player.Statistics.SSJ1.Value, Player.Statistics.SSJG.Value, Player.Statistics.Zeni.Value, Player.Statistics.FSSJ.Value, Player.Statistics.SSJB.Value})
	wait(5)
end)

(The script above is in the following: game.ServerScriptService.FormScripts)

1 comment

0

soviet anthem "our script" jk