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

Why wont this the function binded to an event fire?

Asked by 5 years ago

Hi! My problem is that I made a system where you can breach doors with a "Breaching Charge" item. You would press E on a door to blow it up. There is a local script in the tool that handles user inputs, a remoteEvent in replicatedStorage and a script in a model of serverScriptService

localScript

01local UserInputService = game:GetService("UserInputService")
02 
03local function onInputEnded(inputObject, gameProcessedEvent)
04    -- First check if the 'gameProcessedEvent' is true
05    -- This indicates that another script had already processed the input, so this one can be ignored
06    if gameProcessedEvent then return end
07    -- Next, check that the input was a keyboard event
08    if inputObject.UserInputType == Enum.UserInputType.Keyboard then
09        print("A key was released: " .. inputObject.KeyCode.Name)
10        if inputObject.KeyCode.Name == "E" then
11            if script.Parent.IsEquipped.Value == true then
12                local doorRadius = 10
13                local position = script.Parent.Parent.PrimaryPart.Position
14 
15 
View all 35 lines...

script

01print("load")
02function pick(plr, door)
03    print("exploding")
04    if #game.Teams.Police:GetPlayers() > 0 then
05        print("is there a cop? yes")
06        plr.Charcter.BreachingCharge:Destroy()
07        print(plr)
08        print(door)
09        plr.Backpack.Hostile.Value = true
10        local Expl = Instance.new("Explosion")
11        Expl.DestroyJointRadiusPercent = 0
12        Expl.Position = door.Position
13        Expl.Parent = door
14        door.Picked.Value = true
15        door.Transparency = 1
View all 36 lines...
0
I belive I may have fixxed it pengalu200 65 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

I fixed it! Turns out I spelled Character wrong XD

Ad

Answer this question