Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Workspace.NextGameTimer:2: attempt to call field 'FreddyF' (a userdata value)? Help please?

Asked by 10 years ago

So I've just started scripting today and I've come across this error:

Workspace.NextGameTimer:2: attempt to call field 'FreddyF' (a userdata value)

What I want this code to do is to: A) Have a small countdown before displaying a message B) Bring up 5 GUI buttons to morph into when you click on them

Unfortunately, I'm having a lot of trouble with B. What I want to happen is that when I click on one of the 5 buttons, it morphs me into the "FreddyF" model. However, I am getting the error that is seen above and I don't know how to fix it. Here is my code:

function freddymorph()

Freddy = game.Workspace.FreddyF ("FreddyF")

clone = Freddy:clone()

if Freddy == nil then print("WHERE IT GO?!??!")

newClone = clone:Clone()

newClone.Parent = workspace

newClone:MakeJoints()

game.Players[freddymorph.Parent.Name].Character = newClone

end

end

timer = 5

function message()

m = Instance.new("Message", game.Workspace)

m.Text = "Time is up! Select your character!"

wait(3)

m:remove()

end

repeat

timer = timer -1

wait(1)

until timer == 0

if timer == 0

then message()

local fa = Instance.new("TextButton")

local sa = Instance.new("ScreenGui")

fa.Parent = sa

sa.Parent = game.Players.Player.PlayerGui

fa.Position = UDim2.new(0.1, 0, 0.1, 0)

fa.Size = UDim2.new(0.1, 0, 0.2, 0)

  local fb = Instance.new("TextButton")
  

local sb = Instance.new("ScreenGui")

fb.Parent = sb

sb.Parent = game.Players.Player.PlayerGui

fb.Position = UDim2.new(0.2, 0, 0.1, 0)

fb.Size = UDim2.new(0.1, 0, 0.2, 0)

  local fc = Instance.new("TextButton")
  

local sc = Instance.new("ScreenGui")

fc.Parent = sc

sc.Parent = game.Players.Player.PlayerGui

fc.Position = UDim2.new(0.3, 0, 0.1, 0)

fc.Size = UDim2.new(0.1, 0, 0.2, 0)

  local fd = Instance.new("TextButton")
  

local sd = Instance.new("ScreenGui")

fd.Parent = sd

sd.Parent = game.Players.Player.PlayerGui

fd.Position = UDim2.new(0.4, 0, 0.1, 0)

fd.Size = UDim2.new(0.1, 0, 0.2, 0)

  local fe = Instance.new("TextButton")
  

local se = Instance.new("ScreenGui")

fe.Parent = se

se.Parent = game.Players.Player.PlayerGui

fe.Position = UDim2.new(0.5, 0, 0.1, 0)

fe.Size = UDim2.new(0.1, 0, 0.2, 0)

fa.MouseButton1Down:connect(freddymorph)

fb.MouseButton1Down:connect(freddymorph)

fc.MouseButton1Down:connect(freddymorph)

fd.MouseButton1Down:connect(freddymorph)

fe.MouseButton1Down:connect(freddymorph)

wait(30)

end

Also since I'm new to scripting I might ask you a few questions about your answer to try and explain to me since I don't know much. Thank you so much in advance!

EDIT: Oh god the formatting has gone terribly wrong I am so sorry I don't know how to fix this

1 answer

Log in to vote
1
Answered by
Bman8765 270 Moderation Voter
10 years ago

On line 2 try

Freddy = game.Workspace.FreddyF["FreddyF"]

If this works please tell me, if not please alert me with the new problem so I can edit my answer to help others looking for a solution!

0
Explain why what he did doesn't work! Perci1 4988 — 10y
Ad

Answer this question