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

Help me on this script???

This script only gives a tool when a player touches it ,but i want everyone to get the tool help?

function onTouched(fish)
	local player = game.Players:playerFromCharacter(fish.Parent)
	local h = fish.Parent:findFirstChild("Humanoid")
	if h~=nil then
		if player ~= nil then 
			game.Lighting.Hammer:Clone().Parent = player:FindFirstChild("Backpack")
            script.Parent:remove()
	end
end
end
script.Parent.Touched:connect(onTouched)

1 answer

Line 2: PlayerFromCharacter() is not correct.

Correct:

 local player = game.Players:GetPlayerFromCharacter(fish.Parent)

And by the way, you don't need the humanoid check, because if 'player' checks out, it is guaranteed to have a humanoid.

2 comments

0

its works for me :3

0

It's possible they are aliases for the same thing, but you should be using this one instead.

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