Need help with damage after morphing

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!

I want the player to start taking damage after time after morphing

  1. What is the issue? Include screenshots / videos if possible!

I can’t find out how to make the player take damage after morphing

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

I have searched Google, Devforum, Youtube, and tried making scripts. Keep in mind I have little to no knowledge in scripting

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

This is my morphing script it makes it so when you click a part you morph i used a tutorial

-- local Model = script.Parent:FindFirstChildOfClass("Model")
local ModelName = Model.Name
local ClickToMorph = script.Parent.ClickToMorph
local ClickDetector = ClickToMorph.ClickDetector
local ServerStorage = game:GetService("ServerStorage")
local Morphs = ServerStorage.Morphs

ClickDetector.MouseClick:Connect(function(plr)
	local Character = plr.Character
	local Root = plr.Character:FindFirstChild("HumanoidRootPart")
	local MorphCharacter = Morphs:FindFirstChild(ModelName):clone()
	MorphCharacter.HumanoidRootPart.CFrame = Root.CFrame
	plr.Character = MorphCharacter
	Character:Destroy()
	MorphCharacter.Parent = workspace

end)

Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.

1 Like

Does it do genuine damage or is it just the damage effect?
And I’d assume it’s because you destroy the character.

1 Like

i dont have a way to damage the player and also i want it to actully damage the player

When the players Character is changed they take damage that may be you issue.

ok i think i did not word this post correctly but basically what i need is a script that damages the player consistently 5 seconds after morphing

-- local Model = script.Parent:FindFirstChildOfClass("Model")
local ModelName = Model.Name
local ClickToMorph = script.Parent.ClickToMorph
local ClickDetector = ClickToMorph.ClickDetector
local ServerStorage = game:GetService("ServerStorage")
local Morphs = ServerStorage.Morphs

ClickDetector.MouseClick:Connect(function(plr)
	local Character = plr.Character
	local Root = plr.Character:FindFirstChild("HumanoidRootPart")
	local MorphCharacter = Morphs:FindFirstChild(ModelName):clone()
	MorphCharacter.HumanoidRootPart.CFrame = Root.CFrame
	Character:Destroy()
	plr.Character = MorphCharacter
	MorphCharacter.Parent = workspace
while wait(5) do 
plr.Character:FindFirstChild("Humanoid"):TakeDamage(5)
plr.Character:FindFirstChild("Humanoid").Died:Connect(function()
break
end)
end
end)

k ima try it i will tell if it works

1 Like

the output has a error its this
image

to fix that change break to return

@Caveman_Farts Does it work as intended now?

im checking right now 1 second

1 Like

how do i fix this
image

you commented out the model line so remove the “- -” and you also dont need that to be a variable.

ok thank you so much it works have a great day

1 Like

Im glad that i could help make sure to mark the post as solved.

oh one more question if your not busy. how do i make the script stop after death because the player keeps taking damage when they respawn

in the while loop check if the players health is less than or equal to 0 and if it is break the loop and restart it.

ok but how exactly do i do that

if you give me a moment I could write it out for you.

1 Like

This should work sorry if it’s formatted incorrectly I’ve not gotten a chance to write it in a script editor