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

How do I call upon this without using a local script?

Asked by
soutpansa 120
7 years ago

Hello! I've been working on a small, one person project for about 4 days now. Basically all you do is get stronger so that you can beat other players, NPCs, and bosses. Progress was going great and smoother than butter, until I ran into a problem while making an Air punch, or ranged punch. The script makes a ball shaped shockwave come from the user, and it works fine. Here is the script to it: (might need to look at it for the problem that I have)

Player = script.Parent.Parent
mouse = Player:GetMouse()




function onKeyDown(key)
local Key = key:lower()
if key == "z" and Player.Levelss.Level.Value >= 15  then
local x = Instance.new("Part")
x.BrickColor = BrickColor.new("White")
x.Material = "Neon"
x.Transparency = 0.6
x.Size = Vector3.new(10,10,10)
x.TopSurface = "Smooth"
x.BottomSurface = "Smooth"
x.Shape = "Ball"
local fd = script.fireDamage:clone()
fd.Parent = x
local a = Instance.new("Sound")
        a.SoundId = "http://www.roblox.com/asset/?id=260430117"
        a.Parent = x
        a.Volume = 2
        a:play()




local y = Instance.new("BodyVelocity")
y.maxForce = Vector3.new(math.huge ,math.huge ,math.huge)
y.velocity = Player.Character.Torso.CFrame.lookVector*95

x.CFrame = Player.Character.Torso.CFrame*CFrame.new(0, 0 , -12)
x.Parent = Workspace
y.Parent = x    
game.Debris:AddItem(x, 6)


end
end


mouse.KeyDown:connect(onKeyDown)

That script works great, and does exactly what I want it to (if player's level is over 15 then this move can be used, and the move works)

But my problem is where you see local fd = script.fireDamage:clone() fd.Parent = x

The fireDamage script is what the ranged punch script uses to damage other players, but I have an IntValue placed inside of the player via DataPersistance. The damage value is called FAP. Why did I name it that? I'm not sure. Back to the main topic, I cant get the damage value because I need local player to grab it, but when I try to make fireDamage a local script, I get the error "touched is not a valid member of local script". Here is the fireDamage script incase you need a look:

local Player = game.Players.LocalPlayer
local damage = Player.Levelss.FAP.Value 

function onDamage(Part)
    if Part.Parent:FindFirstChild("Humanoid") ~= nil and Part.Parent.Name ~= "" then




            Part.Parent.Humanoid.Health = Part.Parent.Humanoid.Health - damage
            wait(0.05)
        end
        Part.Parent.Humanoid.Sit = true
        script.Parent:remove()

    end
    wait(0.025)


script.Parent.Touched:connect(onDamage)

0
So, is fireDamage a part or what is it? A healthy note to add, don't include .Value when declaring variables, bound to get an error. Just do, xXLegendarySoldierXx 129 — 7y
0
local damage = Player.Levelss.FAP and just call the .Value part in the function xXLegendarySoldierXx 129 — 7y
0
fireDamage is a script, Thanks for the info too, but I figured it out on my own. I just put a value inside of fireDamage and put a script inside of the value to add FAP to the value. All is well now soutpansa 120 — 7y

Answer this question