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

I am trying to script a player variable to a script and I can't, How do I do it?

Okay so. I want to know how I can get a local Player = but I tried everything

I have a script so I can't do local Player = game.Players.LocalPlayer. I tried to make a parameter in the function and tried game.Players:GetPlayerFromCharacter(part.Parent). But it displays:

"Workspace.Part.SurfaceGui.TextButton.Script:12: attempt to index local 'player' (a nil value)"

Here is the code:

local prog = 0

script.Parent.MouseButton1Click:connect(function(part)
	prog = prog + 5
	print("Cutting wood!")
	script.Parent.Parent.Parent.Part.SurfaceGui.Frame.Frame.Size = UDim2.new(prog/100, 0, 1, 0)
	if prog == 100 then
		prog = 0
		wait(.2)
		script.Parent.Parent.Parent.Tree:Destroy()
		script.Parent.Parent.Parent:Destroy()
	end
end)

1 answer

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