I want to launch a RemoteEvent dependend on the Player’s Value in his PlayerScripts as soon as an UI-Button is pressed. I used the “if/elseif” staments to determine what Value the Player has and which Remotefunction should be fired(activated).
My issue is that the RemoteEvents won’t fire(activate). I know that because i put a “print” statement into each “if/elseif” statement which won’t print anything into the output meaning that the RemoteEvent won’t fire either.
I also know that the RemoteEvents themselves work perfectly fine because i was able to fire them in different localscripts before without any issue.
This is the function btw:
pb.MouseButton1Click:Connect(function()
print("function")
if val == 1 then
print("Infantry")
Infantry:FireServer()
elseif val == 1.5 then
print("Infanterie")
Infanterie:FireServer()
elseif val == 2 then
Assault:FireServer()
print("Assault")
elseif val == 2.5 then
Sturmsoldat:FireServer()
print("Sturmsoldat")
elseif val == 3 then
Support:FireServer()
print("Support")
elseif val == 3.5 then
Unterst:FireServer()
print("Unterstützer")
elseif val == 4 then
Sniper:FireServer()
print("Sniper")
elseif val == 4.5 then
Scharfschuetze:FireServer()
print("Scharfschütze")
end
game.StarterGui.Deserteur.FDesert1.Visible = false
cc.CameraType = Enum.CameraType.Custom
--workspace.Menu.GPart.BillboardGui.Frame.ImageLabel.Visible = false
--workspace.Menu.FPart.BillboardGui.Frame.ImageLabel.Visible = false
--workspace.Menu.GPart.BillboardGui.Frame.Visible = false
--workspace.Menu.FPart.BillboardGui.Frame.Visible = false
pb:Destroy()
bg:Destroy()
l:Destroy()
WL:Destroy()
script.Parent.Parent.Inventory.Enabled = true
game:GetService("UserInputService").MouseIconEnabled = false
end)