yea I can’t even cod up with how to script it. but my gaster blaster keeps killing me although I do not want that to happen. or do i just leave it like that (i don’t want to leave it like that)
please help me with this mess that i am not able to fix.
Check if the part that it is hitting is the child of the player.
example:
part.Touched:Connect(function(part)
if part.Parent == player.Name then
return
elseif part.Parent.Parent == player.Name then
return
end
end)
That won’t work, you’re attempting to compare a Instance with a String value
Better to check for the Player’s Character instead:
local Tool = script.Parent
local Handle = Tool.Handle
Tool.Equipped:Connect(function()
local Character = Tool.Parent
Handle.Touched:Connect(function(Hit)
if Hit.Parent ~= Character then
--Do random stuff
end
end)
end)
hit.name would work i was just trying to be quick
wait were do i put the script in, in the model?
Oh wait it’s supposed to be an actual part from a Blaster- HM
Alright so what I’d do is create a Blaster Part every time when the tool gets activated, then check if the Blaster Part that hit it is equal to the Player’s Character
If it is, then it’ll just ignore the player
Something like this perhaps?
local Tool = script.Parent
local Handle = Tool.Handle
local Character
Tool.Activated:Connect(function()
local BlasterPart = Instance.new("Part")
BlasterPart.Size = Vector3.new(50, 15, 50)
BlasterPart.Position = Handle.Position
BlasterPart.Anchored = true
BlasterPart.Parent = workspace
BlasterPart.Touched:Connect(function(Hit)
if Hit.Parent ~= Character then
--Do random stuff
end
end)
end)
Tool.Equipped:Connect(function()
Character = Tool.Parent
end)
Also the script should be a parent of the tool (Script > Tool)
but the thing is there is no part, it is a script that makes a part and it makes it shoot.
W h a t
Then just make the part check if it hit the Player that cast the Blaster, you’d need to do some sanity check though (StringValue, ObjectValue, idk)
Could you send a picture of the hierarchy and any scripts included in the model? I’m having a hard time understanding exactly how the tool works.
use an if statement
to check if its not you that got touched
if
its not you kill
else
dont kill
this is the asset id. rbxassetid://6593841988
That’s not what I mentioned
I meant you need to implement some type of sanity check via scripting wise
So that the Part can detect the Player that first cast it won’t damage that specific player
I still don’t get it. but I will just stop with this.
If you still don’t get it, then I highly encourage you to do some research on how this stuff works
We’re just giving examples on how we can help you on our situation, we can’t just give you an exact specific “script” on how your Tool/Model works as you have to figure it out on your own
Easy fix once again
so, just detect if the ray/mouse hits your character and if it does then return