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

Variables has no value?[SLOVED]

Asked by 6 years ago
Edited 6 years ago

I'm storing numbers in variables to use them later. But everything works fine until it gets to line 23. Here's the error i got

20:53:26.978 - ReplicatedFirst.BedScript:23: bad argument #3 to 'Angles' (number expected, got no value)

local player = game.Player.LocalPlayer
local char = player.Character
local mouse = Player:GetMouse()
local debounce = false
local cframeS  --position
local cframeE  --position
local cframeSA  --angles
local cframeEA  --angles

 mouse.Button1Down:connect(function()
    if debounce == false then
        debounce = true 
        print(mouse.Target.Name)
        if mouse.Target.Name == "BedPart"then
         local part = game.Workspace.EventParts:FindFirstChild(mouse.Target.Name)
   if part.Value == "Bed1"then
    cframeS = 428.399, 138, 255.3
    cframeSA = 0,185.5,0
   elseif part.Value == "Bed2"then
    cframeS = 428.399, 138, 239.8
    cframeSA = 0,0,0
    end
char.HumanoidRootPart.CFrame = CFrame.new(Vector3.new(cframeS)) * CFrame.Angles(cframeSA)
wait(5)
Debounce = false
  end
 end
end)
0
Don't know if this will correlate but maybe your "mouse.Button1Down:connect(function()" and it's contents should be moved one tiny line back like just a press of a backspace for the function and it's contents. User#17624 0 — 6y
0
No it didn't help but, thanks for trying :D cornman601 59 — 6y
1
For lines 17-18, and 20-21, that's for possible from what you're trying to accomplish: You have to convert those number into a vector3 value first (I believe). TheeDeathCaster 2368 — 6y
0
Btw, CFrame.Angles work in radians: To accomplish what you're trying to do, use the `math.rad` function. :) TheeDeathCaster 2368 — 6y
View all comments (3 more)
0
What do you mean by for possible, and i'll try the math.rad cornman601 59 — 6y
0
OH WAIT, lol i defined the variables wrong... oops cornman601 59 — 6y
0
If you have figured out the problem, be sure to edit the title to include something like "[Solved]" chess123mate 5873 — 6y

Answer this question