Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

this script works but this one dosent? While Both are the same?

The script that dosent work

local player = game.Players.LocalPlayer or game.Players.PlayerAdded:Wait()
local character = player.Character or player.CharacterAdded:Wait()
local part = script.Parent["Left Hand Glove"]
local weld = Instance.new("Weld",part)
local debounce = false
weld.Part0 = part
weld.Part1 = character["Left Arm"]

local tool = script.Parent

tool.Equipped:Connect(function() -- it just dosent give a signal like what
	if not debounce then
		character.Humanoid.MaxHealth = character.Humanoid.MaxHealth + 10
		character.Humanoid.Health = character.Humanoid.Health + 10
		debounce = true
	end
end)

the script that works

local player = game.Players.LocalPlayer or game.Players.PlayerAdded:Wait()
local character = player.Character or player.CharacterAdded:Wait()
local part = script.Parent["Blocky Hat"]
local weld = Instance.new("Weld",part)
local debounce = false
weld.Part0 = part
weld.Part1 = character.Head

local tool = script.Parent

tool.Equipped:Connect(function()
	if not debounce then
		character.Humanoid.MaxHealth = character.Humanoid.MaxHealth + 50
		character.Humanoid.Health = character.Humanoid.Health + 50
		local hatclone = script.Parent["Blocky Hat"]:Clone()
		hatclone.Parent = character.Head		
		debounce = true
	end
end)

both scripts go in tools

1 answer

✓ Accepted answer
local player = game.Players.LocalPlayer or game.Players.PlayerAdded:Wait()
local character = player.Character or player.CharacterAdded:Wait()
part = script.Parent["Left Hand Glove"]
local debounce = false

local tool = script.Parent

tool.Equipped:Connect(function() 
	if character.Humanoid.RigType == Enum.HumanoidRigType.R15 then
		local weld = Instance.new("Weld",part)
		weld.Part0 = part
		weld.Part1 = character["LeftHand"]
	else
		local weld = Instance.new("Weld",part)
		weld.Part0 = part
		weld.Part1 = character["Left Arm"]
	end
	if not debounce then
		character.Humanoid.MaxHealth = character.Humanoid.MaxHealth + 10
		character.Humanoid.Health = character.Humanoid.Health + 10
		debounce = true
	end
end)

Ive edited the script that does nothing on studio and now it works

2 comments

0

it like dosent detect when the player equips it for some reason

0

it changed my health to 110 so it does detect

This discussion is preserved as it was. New answers, comments, and votes are closed.