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

Can someone help me, as I'm trying to change a gun's script to a raycasting function? [closed]

Asked by 9 years ago

Hello, I'm Bladeor, and I am making a game called Mutiny. I need scripting help with a weapon I acquired from a friend. I need someone to help me change this function from a spawn a part and throw it forward script to a raycasting script. This is because this script works in Studio, but not in actual gameplay after I upload it.

Here is the function part of the script. There is much more script above and below it.

function fire(v)


    Tool.Handle.Fire:play()


    local vCharacter = Tool.Parent
    local vPlayer = game.Players:playerFromCharacter(vCharacter)

    local missile = Instance.new("Part")



    local spawnPos = vCharacter.PrimaryPart.Position



    spawnPos  = script.Parent.Shot.Position

        local spawnPos = vCharacter.Musket.Flame.Position

    spawnPos  = spawnPos + (v * 200)



    missile.Position = spawnPos
    missile.Size = Vector3.new(1,1,1)
    missile.Velocity = v * 800
    missile.BrickColor = BrickColor.new("Bright Blue")
    missile.Shape = 0.5
    missile.BottomSurface = 0
    missile.TopSurface = 0
    missile.Name = "Paintball"
    missile.Elasticity = 0
    missile.Reflectance = .1
    missile.Friction = .3


    local force = Instance.new("BodyForce")
    force.force = Vector3.new(0,100,0)
    force.Parent = missile


    local force = Instance.new("BodyForce")
    force.force = Vector3.new(0,missile:GetMass() * 1,0)
    force.Parent = missile

    local mesh = Instance.new("SpecialMesh")
    mesh.Scale = Vector3.new(.2,.2,.2)
    mesh.MeshType = "Sphere"
    mesh.Parent = missile

    local new_script = script.Parent.Bullet:clone()
    new_script.Disabled = false
    new_script.Parent = missile

    local creator_tag = Instance.new("ObjectValue")
    creator_tag.Value = vPlayer
    creator_tag.Name = "creator"
    creator_tag.Parent = missile



    missile.Parent = game.Workspace


0
I guess I should probably learn Raycast myself, as I'm working on guns for my survival game. >.< dirty_catheter 7 — 9y
0
That's a good idea! Bladeor 0 — 9y

Closed as Not Constructive by Unclear

This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.

Why was this question closed?