Doom Eternal Chainsaw Glory Kill in Roblox

So i’m trying to remake the chainsaw glory kill from Doom Eternal, and i’m trying to get to a point where I can walk up to a dummy (that has the script in it) and press F to fire an event.

So the code below is from a post made in may, which should work, but doesn’t.

local  UIS =  game:GetService('UserInputService')
local plr = game.Players.LocalPlayer
UIS.InputBegan:Connect(function(input,gpe) 
 if input.KeyCode == Enum.KeyCode.X and not gpe then -- X is just an example change it to whatever you want.
   if (plr.Character.HumanoidRootPart.Position - yourPart.Position).magnitude <= 10  then -- 10 is the distance in studs 
-- you can fire your event here to handle it.
    end
   end
end)
3 Likes

put a print(“string”) in the place you should fire you event to see if the event fires

1 Like

That code requires a LocalScript and that it be located in some client-specific location. If the dummy model is located in workspace (and not a child of the camera) then it won’t do anything.

From what I’m seeing, this code was likely given to you by someone else. It needs to go in a LocalScript, then probably into StarterCharacterScripts, and you need to define the variable “yourPart”

1 Like

I did replace YourPart And Everything was in a Local Script

1 Like

Where is the LocalScript located? Please provide the full path (not just that it’s in the dummy)

1 Like

image

Sure

2 Likes

put the local script in either starterplayer, startergui or starterpack and see if it works, because I just tested it in studio and it works for me

1 Like

Thanks! It worked, I can’t Believe I didn’t try that. Thank you so much!

2 Likes

please mark me as solution, it helps :slight_smile:

1 Like