A code that don't work again...
Hi, can anyone please help me about that code?I wanted to make it like a teleporter but even player touches the part, nothing happens...there's no error code.Here's the code:
local Portal = game['Environment']['PortalNormal']
Portal.Touched:Connect(function(hit)
if hit:IsA('Player') or hit:IsA('NPC') then
hit.Position = game['Environment']['SpawnPointBattle'].Position
else
print('It is not a player or NPC, so it did not teleported.')
end)
Proud owner of NightWork Studios ۞
I got it but I have another problem now, can anyone help?Code:
local slashDamage = 5
local SlapCounter = game['PlayerGUI']['SlapGUI']['UILabel']
local tool = script.Parent
local handle = tool["Handle"]
local slash = handle["Slash"]
local isavabile = true
handle.Touched:Connect(function(hit)
if script.Parent.Parent == nil then
return
end
if script.Parent.Parent:IsA("Player") == false then
return
end
if hit:IsA("Player") or hit:IsA("NPC") then
if hit.Health > 0 then
hit.Health = hit.Health - slashDamage
SlapCounter.Text = SlapCounter.Text + 1
hit.Position = hit.Position + 0, 2, 0
hit.Position = hit.Position - 0, 0, 5
hit.WalkSpeed = 0
wait(0.5)
hit.WalkSpeed = 16
end
end
end)
tool.Activated:Connect(function()
if isavabile == true then
slash:Play()
tool:Play("slash")
isavabile = false
wait(2)
isavabile = true
end
end)
Proud owner of NightWork Studios ۞