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

"Considering changing it to local"?

Asked by 3 years ago

I'm working on a creature-styled fighting game and have had some issues reusing tools from old Pokemon games. I've tried multiple things but in the end, the tools never do damage. They'll charge and/or shoot something, but it doesn't damage the other player. If I could get any help or ideas on what I can try, that'd be super helpful.

There's two different scripts involved, the tool script and the damage script, listed below.

Tool script:

bin = script.Parent
me = script.Parent.Parent.Parent

enabled = true

function onButton1Down(mouse)
if not enabled then
        return
    end

    local player = game.Players.LocalPlayer
    if player == nil then return end
        enabled = false


    mouse.Icon = "rbxasset://textures\\GunWaitCursor.png"

t = me.Character:findFirstChild("Torso")
if t ~= nil then

hax = game.Lighting.LeafBlade1:clone()
hax.Parent = t
wait(0.05)
p = Instance.new("Part")
p.Parent = game.Workspace
p.CanCollide = false
p.Transparency = 1
p.CFrame = me.Character.Torso.CFrame * CFrame.fromEulerAnglesXYZ(0, 0, 0)
d = Instance.new("BodyVelocity")
d.Parent = me.Character.Torso
d.maxForce = Vector3.new(math.huge, math.huge, math.huge)
d.velocity = p.CFrame.lookVector * 100
me.Character.Torso.CFrame = me.Character.Torso.CFrame * CFrame.fromEulerAnglesXYZ(0, 0, 0)
wait(0.15)

d:Remove()
p:Remove()
wait(0.1)
hax:Remove()

wait(3)
    mouse.Icon = "rbxasset://textures\\GunCursor.png"
    enabled = true

end
end


function onS(mouse) 
mouse.Button1Down:connect(function() onButton1Down(mouse) end) 
end 
bin.Selected:connect(onS)

Damage script:

function onTouched(hit)
humanoid = hit.Parent.Parent:findFirstChild("Humanoid")
if humanoid ~= nil then
if humanoid.Parent ~= script.Parent.Parent then
humanoid.Health = humanoid.Health - 20
hit.CFrame = hit.CFrame * CFrame.fromEulerAnglesXYZ(-0.4, 0, 0)
for i = 1 , 1 do
p = Instance.new("Part")
p.Parent = game.Workspace
p.CanCollide = false
p.BrickColor = BrickColor.new(21)
p.Size = Vector3.new(1, 1, 1)
p.TopSurface = "Smooth"
p.BottomSurface = "Smooth"
p.CFrame = hit.CFrame
p.Velocity = Vector3.new(math.random(-50, 50), math.random(30, 50), math.random(-50, 50))
d = Instance.new("SpecialMesh")
d.Parent = p
d.MeshType = "Brick"
d.Scale = Vector3.new(0.2, 0.2, 0.2)
game:GetService("Debris"):AddItem(p,5)
end
end
end
end
script.Parent.Touched:connect(onTouched)
0
lowercase Connect and :Remove are depracated. Use uppercase connect and :Destroy() instead JeffTheEpicRobloxian 258 — 3y
0
Switched them all to the proper ones you said, however the tool still doesn't do damage. Voiaman2 0 — 3y

Answer this question