Not sure if i should mentioned but the part is touched while the player is in a drive seat of a car
Which is why it prints out body as theres a model called body in the car
Not sure if i should mentioned but the part is touched while the player is in a drive seat of a car
Which is why it prints out body as theres a model called body in the car
NOOOOOO. Why didnt you say that earlier
Now you know what you are actually sending. Try to adress the character from there, We can’t since we don’t really know the model of the car and what is where.
Good point. @A5LNX Can you send the file structure of the car. Here is a example a chasis file structure. I want to see where the driver seat is.
Exactly the same like the one you just sent
Is the seat named the same?
dfjdksfjsdfsdfsfsdf
Yes
(hrfhjhrejfehrfjgrgrg3e3e3e3e)
I hate this monstrossity i just did but it should work
local Stage2 = script.Parent
local AttackModeActivated = game.ServerStorage.AttackModeActivated
Stage2.Touched:Connect(function(otherPart)
print(otherPart)
--mazltus wrote this not me. Thats why its so horrible
if otherPart.Humanoid ~= nil then AttackModeActivated:Fire(otherPart)
elseif otherPart.Parent.Humanoid ~= nil then AttackModeActivated:Fire(otherPart.Parent)
elseif otherPart.Parent.Parent.Humanoid ~= nil then AttackModeActivated:Fire(otherPart.Parent.Parent)
elseif otherPart.Parent.Parent.Parent.Humanoid ~= nil then AttackModeActivated:Fire(otherPart.Parent.Parent.Parent)
elseif otherPart.Parent.Parent.Parent.Parent.Humanoid ~= nil then AttackModeActivated:Fire(otherPart.Parent.Parent.Parent.Parent)
elseif otherPart.Parent.Parent.Parent.Parent.Parent.Humanoid ~= nil then AttackModeActivated:Fire(otherPart.Parent.Parent.Parent.Parent.Parent)
elseif otherPart.Parent.Parent.Parent.Parent.Parent.Parent.Humanoid ~= nil then AttackModeActivated:Fire(otherPart.Parent.Parent.Parent.Parent.Parent.Parent)
else
error("Code broke")
end
end)
101 reasons why lua should have switch statements
@A5LNX This could work
local Stage2 = script.Parent
local AttackModeActivated = game.ServerStorage.AttackModeActivated
Stage2.Touched:Connect(function(otherPart)
print(otherPart)
local function dostuff (character : model)
print(character.Name)
AttackModeActivated:Fire(character)
end
if otherPart.DriveSeat.Occupant.Parent ~= nil then dostuff(otherPart.DriveSeat.Occupant.Parent)
elseif otherPart.Parent.DriveSeat.Occupant.Parent ~= nil then dostuff(otherPart.Parent.DriveSeat.Occupant.Parent)
elseif otherPart.Parent.Parent.DriveSeat.Occupant.Parent ~= nil then dostuff(otherPart.Parent.Parent.DriveSeat.Occupant.Parent)
elseif otherPart.Parent.Parent.Parent.DriveSeat.Occupant.Parent ~= nil then dostuff(otherPart.Parent.Parent.Parent.DriveSeat.Occupant.Parent)
elseif otherPart.Parent.Parent.Parent.Parent.DriveSeat.Occupant.Parent ~= nil then dostuff(otherPart.Parent.Parent.Parent.Parent.DriveSeat.Occupant.Parent)
elseif otherPart.Parent.Parent.Parent.Parent.Parent.DriveSeat.Occupant.Parent ~= nil then dostuff(otherPart.Parent.Parent.Parent.Parent.Parent.DriveSeat.Occupant.Parent)
elseif otherPart.Parent.Parent.Parent.Parent.Parent.Parent.DriveSeat.Occupant.Parent ~= nil then dostuff(otherPart.Parent.Parent.Parent.Parent.Parent.Parent.DriveSeat.Occupant.Parent)
else
print("Code broke")
end
end)
didnt print anything out except otherpart, but i did some testing and without the car it works perfectly fine and adds the value, but with the car it starts making problems
otherpart is #Weight in output
Thats wierd can i see a screenshot?
Its the only thing in the output, so there isnt much to send a screenshot about.
Found the sollution after some testing on a empty baseplate
This is the whole code:
local AttackModeActivated = game.ServerStorage.AttackModeActivated
script.Parent.Touched:Connect(function(part)
pcall(function()
if part.Parent.Humanoid ~= nil then
AttackModeActivated:Fire(part.Parent)
end
end)
end)
I got no error, but didn’t add value?
What value?
asdasdasdadasdasdsddfsadfsdfsdfsdf
I mean the +1 its meant to add onto the value
allPlayers[table.find(allPlayers, player)].AttackModeActivations.Value += 1
this part