local typer = require(game.ServerStorage.Type)
local tweenService = game:GetService("TweenService")
local tweenInfo = TweenInfo.new(5, Enum.EasingStyle.Sine, Enum.EasingDirection.Out)
local goal = {}
goal.Size = Vector3.new(0.1, 34.4, 28.6)
local tween = tweenService:Create(game.Workspace.Blood,tweenInfo,goal)
print("tweens written")
script.Parent.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") and hit.Parent ~= script.Parent.Parent.Parent then
game.Players.PlayerAdded:Connect(function(plr)
print("connected")
local ui = plr.PlayerGui
local walk = ui.WalkthroughUI
local spek = walk.Frame.SpeakerText
print("locations")
plr.CharacterAdded:Connect(function(char)
char.HumanoidRootPart.Position = Vector3.new(-981, 1.5, -981)
char.HumanoidRootPart.Anchored = true
typer.type(spek,"Where am I again?")
typer.type(spek,"Wait..")
typer.type(spek,"I'm the monster..")
typer.type(spek,"OH LORD..")
typer.type(spek,"WHAT'S HAPPENING TO ME?")
game.SoundService.Death:Play()
char.Humanoid.Sit = true
tween:Play()
print("type")
for i = 100,0,2 do
char.Humanoid.Health = i
wait(.1)
end
end)
end)
end
end)
This is a script inside of the handle of a tool, the tool is parented to an npc that moves to the character. When the character touches me with the tool, ABSOLUTELY NOTHNIG HAPPENS. What am I doing wrong?
This will only fire when a Player gets added to the game, why are you encasing that inside a Touched event? You can simply just call GetPlayerFromCharacter() to obtain the Player & Character that way
local typer = require(game.ServerStorage.Type)
local tweenService = game:GetService("TweenService")
local tweenInfo = TweenInfo.new(5, Enum.EasingStyle.Sine, Enum.EasingDirection.Out)
local goal = {}
goal.Size = Vector3.new(0.1, 34.4, 28.6)
local tween = tweenService:Create(game.Workspace.Blood,tweenInfo,goal)
print("tweens written")
script.Parent.Touched:Connect(function(hit)
local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
if plr then
print("connected")
local char = hit.Parent
local ui = plr.PlayerGui
local walk = ui.WalkthroughUI
local spek = walk.Frame.SpeakerText
print("locations")
char.HumanoidRootPart.Position = Vector3.new(-981, 1.5, -981)
char.HumanoidRootPart.Anchored = true
typer.type(spek,"Where am I again?")
typer.type(spek,"Wait..")
typer.type(spek,"I'm the monster..")
typer.type(spek,"OH LORD..")
typer.type(spek,"WHAT'S HAPPENING TO ME?")
game.SoundService.Death:Play()
char.Humanoid.Sit = true
tween:Play()
print("type")
for i = 100,0,2 do
char.Humanoid.Health = i
wait(.1)
end
end
end)