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

Help With This Local Script?

This works in solo mode but does not work multi Player Any Help?

f = Game.Lighting.FBITalk:clone()

function onTouch(part) 
	local humanoid = part.Parent:FindFirstChild("Humanoid") 
	if (humanoid ~= nil) then
		f.Parent = Game.Players.LocalPlayer.PlayerGui
		script.Disabled = true
	end 
end

script.Parent.Touched:connect(onTouch)

1 answer

✓ Accepted answer

LocalScripts won't run except in the player's Backpack, Character, or PlayerGui.

If this script is just inside some button, it won't work.


I would suggest instead revising the function to the following:

if part.Parent then
	local character = part.Parent;
	local player = game.Players:GetPlayerFromCharacter(character);
	if player then
		f.Parent = player.PlayerGui;
		...
	end
end

2 comments

0

I Tried This In A Script Before And Still Won't Work Any Other Thoughts?

0

Have you also made the modification I suggested . . . ? Using LocalPlayer inside of a normal Script object won't work, so you also need to change your code.

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