Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Attempt to connect failed: Passed value is not a function?

I'm not familiar with Remote functions so I need somebody else to do it please

--//Settings\\--
local Damage = 24


--//What stuff is\\--
--[[ 

K is the bullet hole
The 2 Events are when the bullets shot and when it has hit
The tool is well, the tool
Player is the local player
Mouse is the local players mouse
Canshoot is when the player can shoot

]]


local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
local k = Instance.new("Part")
local Tool = script.Parent.Parent
local canshoot = false
local HasHitEvent = script.Parent.HasHitEvent
local HasShotEvent = script.Parent.HasShotEvent


Tool.Equipped:Connect(function()
    canshoot = true
end)
Tool.Unequipped:Connect(function()
    canshoot = false
end)
local function HasShotEvent()
Mouse.Button1Down:Connect(function()
    if canshoot == true then
        wait(0.5)
        k.Parent = game.Workspace
        k.Color = Color3.fromRGB(1,1,1)
        k.Size = Vector3.new(0.08, 0.08, 0.08)
        k.Anchored = true
        k.CanCollide = false
        k.Position = Vector3.new(Mouse.Hit)
        k.CFrame = Mouse.Hit
        script.Parent.Shoot:Play()
        repeat  wait(.001) script.Parent.PointLight.Enabled = true until script.Parent.Shoot.Playing == false       
        if script.Parent.Shoot.Playing == false then
            script.Parent.PointLight.Enabled = false
HasShotEvent:FireServer()
        end
    end
end)
end

local function HasHitEvent()
function onTouched(hit)
        local human = hit.Parent:findFirstChild("Humanoid")
        if (human ~= nil) then
                human.Health = human.Health - Damage

if k.Touched then
    k:Destroy()
HasHitEvent:FireServer()

end
        end
end
end
k.Touched:connect(onTouched)

3 comments

0

Also if somebody could add a range setting with mag that would be cool

0

What line is the error on?

0

none. it just says that. i believe its the remote functions at the end

1 answer

You should use remote:FireServer() not just :Fire()

This discussion is preserved as it was. New answers, comments, and votes are closed.