Soooo. This problem is a time dissolver. I'm trying to do a game (rpg) with abilities and skills BUT , there is the thing : There's a level system and i wish the abilities to evolve with the level... There's the script... :(
local repstore = game:WaitForChild("ReplicatedStorage")
local Remote = repstore.OFA:WaitForChild("Punch")
Remote.OnServerEvent:connect(function(player)
LDS = player:FindFirstChild("leaderstats")
Level = LDS.Level
end)
function onTouched(hit)
local human = hit.Parent:FindFirstChild("Humanoid")
if (human ~= nil ) and debounce == false and human ~= script.Parent.Parent.Humanoid then
human:TakeDamage(Level.Value * 3)
local position = Instance.new("BodyVelocity",hit.Parent.HumanoidRootPart)
position.MaxForce = Vector3.new(999999999999999,9999999999999,999999999999999)
position.P = 300
position.Velocity = script.Parent.Parent:FindFirstChild("LowerTorso").CFrame.UpVector * 5
game.Debris:AddItem(position,0.1)
script.Disabled = true
debounce = true
wait(1)
debounce = false
end
end
script.Parent.Touched:connect(onTouched)
local repstore = game:WaitForChild("ReplicatedStorage")
local Remote = repstore.OFA:WaitForChild("Punch")
Remote.OnServerEvent:connect(function(player)
LDS = player:FindFirstChild("leaderstats")
Level = LDS.Level
end)
(This part was used to get local player)
The attack deals damage but when i increase the level, attack damage don't increase. My life is a entire nightmare because of this.
Any help is accepted. Thanks for reading. Arthas.
EDIT : This script goes with an other one :
local repstore = game:WaitForChild("ReplicatedStorage")
local Remote = repstore.OFA:WaitForChild("Punch")
Remote.OnServerEvent:connect(function(player)
LArm = player.Character:WaitForChild("LeftLowerArm")
RArm = player.Character:WaitForChild("RightLowerArm")
local human = player.Character:FindFirstChild("Humanoid")
local canattack = true
local Damage2 = script.Damage:Clone()
Damage2.Parent = RArm
canattack = false
human:LoadAnimation(script.L):Play()
Damage2.Disabled = false
wait(0.6)
Damage2:Destroy()
canattack = true
end)
EDIT2 : I think i do everything wrong because of my unexpericence with lua.

9 comments
Don't know if you just forgot to add it but you need an "end)" at the end + a tip: only have 1 remoteEvent and add more variables defined when calling the remoteEvent, that way you can have tons of event with only 1 RemoteEvent, and that means less lag
Thx.
Dont use .Value in a variable. Try doing Level.Value on line 9.
Thanks dinoz but it doesn't work.
Thats not your only issue, just pointing out something that needed to be corrected.
This question was edited and his OnServerEvent included a line that went like "Level = LDS.Level". I'm assuming this should actually be "Level = LDS.Level + 1"
Also, is this only one script with all this code in it?
Thats also confusing me Xpol.
One script ? Yeah.