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

FE Script value asking for Vector3 when is it a normal value?

Asked by 6 years ago

I am honestly confused. When I use a local script from a player's gui, the local script fires a server event that places a thing. However, for some reason. the 'cost' variable is being asked for a vector3 in the logs, when its a number value. Placing ServerEvent Code:

game:GetService("ReplicatedStorage").LocalEvents.Placing.OnServerEvent:connect(function(tower,pos,cost,rotation)
    game:GetService("ReplicatedStorage").Stats.Cash.Value = game:GetService("ReplicatedStorage").Stats.Cash.Value - cost
        local tt = game:GetService("ReplicatedStorage").Storage.Turrets[tower][tower]:Clone()
tt = tt:Clone()
tt.Parent = workspace.Game.Turrets
tt:SetPrimaryPartCFrame(CFrame.new(pos.X,((tt.PrimaryPart.Size.Y/2)+pos.Y)+0,pos.Z)*CFrame.Angles(0,rotation.y,0))
tt.Config.Shoot.Disabled = false
tt.Config.Cost.Value = cost
end)

Player Place LocalScript (Shortened):

tower = "Gunner"
cost = 300
lastrot = math.rad(90)
game:GetService("ReplicatedStorage").LocalEvents.Placing:FireServer(tower,mouse.Hit.p,cost,lastrot)

ServerScriptService.Worker:2: bad argument #1 to '?' (Vector3 expected, got number) Does anybody know why this is occuring? Thanks!

0
OnServerEvent has a default argument, so you need to put another argument on line 1 522049 152 — 6y
0
game:GetService("ReplicatedStorage").LocalEvents.Placing.OnServerEvent:connect(function(plr,tower,pos,cost,rotation) 522049 152 — 6y
0
^ Was going to answer something like that but you answered first. Guess I have to delete my whole answer... User#20279 0 — 6y
0
oof hellmatic 1523 — 6y
View all comments (3 more)
0
I don't know too much about scripting, but what is the variable 'plr' for? OsterDog 14 — 6y
0
Nevermind. I got it working. OsterDog 14 — 6y
0
Please post using a code block. Ignited_Spark -5 — 6y

Answer this question